Jump to content

Script dont work need help please


ZeroPointOne

Recommended Posts

Here is my code: 

Commands.cs: 

using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;

namespace Testing
{
    class Commands : Script
    {
        [Command("veh", "/veh um Fahrzueg zu spawnen")]
        public void cmd_veh(Player player, string vehname, int color1, int color2)
        {
            uint vehash = NAPI.Util.GetHashKey(vehname);
            if (vehash <= 0) 
            {
                player.SendChatMessage("~r~Ungültiger Spawnname");
                return;
            }
            Vehicle veh = NAPI.Vehicle.CreateVehicle(vehash, player.Position, player.Heading, color1, color2);
            veh.NumberPlate = "Spawned";
            veh.Locked = false;
            veh.EngineStatus = true;
            player.SetIntoVehicle(veh, (int)VehicleSeat.Driver);
        }
    }
}

 

Events.cs: using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;

namespace Testing
{
    class Events : Script
    {
        [ServerEvent(Event.PlayerConnected)]
        public void OnPlayerConnected(Player player)
        {
            player.SendChatMessage("Wilkommen auf dem Server!");
        }

        [ServerEvent(Event.PlayerSpawn)]
        public void OnPlayerSpawn(Player player)
        {
            player.Health = 0;
            player.GiveWeapon(WeaponHash.Sniperrifle, 100);
        }
    }
}

there is no console error but it dont work

Console: https://imgur.com/a/qnrll8a

Please help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...