Whats Wrong with my code?
#1

This is my compiler:
C:\Users\Keegan\Desktop\gamemodes\Begginers Drift Script.pwn(41) : error 017: undefined symbol "playerid"
C:\Users\Keegan\Desktop\gamemodes\Begginers Drift Script.pwn(93) : error 017: undefined symbol "vehicleid"
C:\Users\Keegan\Desktop\gamemodes\Begginers Drift Script.pwn(93) : error 017: undefined symbol "COLOR_GREEN"
C:\Users\Keegan\Desktop\gamemodes\Begginers Drift Script.pwn(94) : error 029: invalid expression, assumed zero
C:\Users\Keegan\Desktop\gamemodes\Begginers Drift Script.pwn(94) : error 017: undefined symbol "COLOR_ERROR"

This is my code:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/repair", cmdtext, true, 10) == 0)
	{
		if(IsPlayerAdmin(playerid)) SetVehicleHealth(vehicleid, 1000.0); SendClientMessage(playerid, COLOR_GREEN,"Your Car Has Been Fixed");
		else SendClientMessage(playerid, COLOR_ERROR,"You are not a RCON Admin to do this!");
		return 1;
	}
	return 0;
}
What is wrong with it? Any help.
Reply
#2

pawn Код:
#define COLOR_GREEN           0x33AA33AA // Add this on the top on the script below includes
#define COLOR_ERROR           0xAFAFAFAA
Use this!

and Replace yours with this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        new vehicleid = GetPlayerVehicleID(playerid),giveplayerid;
    if(strcmp(cmdtext, "/repair", true) == 0)
    {
        if(IsPlayerAdmin(playerid))
                {
                SetVehicleHealth(vehicleid, 1000.0);
                SendClientMessage(playerid, COLOR_GREEN,"Your Car Has Been Fixed");
                }
        else return SendClientMessage(playerid, COLOR_ERROR,"You are not a RCON Admin to do this!");
        return 1;
    }
        return 1;
}
Or use this command! Works fine and better
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        new vehicleid = GetPlayerVehicleID(playerid),giveplayerid;
        // Or u can use this. I use it in my server.
        if(strcmp(cmdtext, "/fixveh", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerAdmin(playerid))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You are not authorised to use this command.");
                return 1;
            }
            if(IsPlayerInAnyVehicle(playerid))
            {
                SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
                RepairVehicle(GetPlayerVehicleID(playerid));
                PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, COLOR_GREY, "   Vehicle Fixed !");
            }
        }
        return 1;
    }
        return 1;
}
Reply
#3

Thank You very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)