Whats Wrong with my code? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Whats Wrong with my code? (
/showthread.php?tid=314898)
Whats Wrong with my code? The compiler wont work but i think its fine -
stormchaser206 - 31.01.2012
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.
Re: Whats Wrong with my code? -
Ballu Miaa - 01.02.2012
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;
}
Re: Whats Wrong with my code? -
stormchaser206 - 01.02.2012
Thank You very much