Help with errors -
IvancheBG - 17.05.2012
Xi guys i have errors for two commands.. Here are the errors:
Код:
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : error 029: invalid expression, assumed zero
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : warning 215: expression has no effect
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1289) : warning 202: number of arguments does not match definition
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1289) : warning 202: number of arguments does not match definition
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1289) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Line 1228:
Код:
else if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, COLOR, #RED"Usage: /kick [id/name][reason]");
Line 1289:
Код:
format(string, sizeof(string), #GREEN"You have set %s's health to %d.", GetPlayerName(playa), (health);
And the commands:
Код:
CMD:kick(playerid, params[])
{
new id, reason[128];
if(PlayerInfo[playerid][pAdmin] >= 4)
else if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, COLOR, #RED"Usage: /kick [id/name][reason]");
if(PlayerInfo[playerid][pAdmin] >= 4) return SendClientMessage(playerid, COLOR, #RED"[Warning]:You are not an Admin level 4!");
else if(id==playerid)SendClientMessage(playerid, COLOR, #RED"Error: You can not kick yourself!");
else if(id==IsPlayerAdmin(id))SendClientMessage(playerid, COLOR, #RED"Error: You can not kick another admin!");
else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid, COLOR, #RED"Error: Player is not connected!");
else
{
new Name[MAX_PLAYER_NAME], KickMessage[128];
new Name2[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(id, Name2, sizeof(Name2));
format(KickMessage, sizeof(KickMessage), "%s(%d) has kicked player %s(%d). Reason: %s", Name, playerid, Name2, id);
SendClientMessageToAll(COLOR_RED, KickMessage);
Kick(id);
}
return 1;
}
Код:
CMD:sethp(playerid, params[])
{
new string[128], playa, health;
if(sscanf(params, "ud", playa, health))
{
SendClientMessage(playerid, COLOR, #RED"USAGE: /sethp [playerid] [health]");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
SetPlayerHealth(playa, health);
format(string, sizeof(string), #GREEN"You have set %s's health to %d.", GetPlayerName(playa), (health);
SendClientMessage(playerid, COLOR, string);
}
}
else SendClientMessage(playerid, COLOR, #RED"Invalid player specified.");
}
else
{
SendClientMessage(playerid, COLOR, #RED"You are not authorized to use that command!");
}
return 1;
}
Re: Help with errors -
iRage - 17.05.2012
Very basically, you're not putting your color defines in their location
Remove every single #RED, #BLUE, #SHIT you've put and follow this reference for sending client messages.
SendClientMessage(playerid, color, "text");
SendClientMessageToAll(color, "text");
What if you want to use multicolors?
Here's a color you'd like to use, let's say you have COLOR_WHITE defined as 0xFFFFFFFF, follow this procedure to extract the color's code for
SendClientMessage
Remove the 0x and last 2 F's from the color
0xFFFFFF
FF
Copy the remaining text into a {}
{
FFFFFF}
Put the {FFFFFF} INSIDE the text quotations.
SendClientMessage(playerid,
AnyColor, "This text has AnyColor color,
{FFFFFF}This text has white color.");
Re: Help with errors -
IvancheBG - 17.05.2012
Now i have this? :
Код:
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : error 029: invalid expression, assumed zero
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : warning 215: expression has no effect
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : error 017: undefined symbol "FF0000"
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Код:
CMD:kick(playerid, params[])
{
new id, reason[128];
if(PlayerInfo[playerid][pAdmin] >= 4)
else if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, {FF0000}, "Usage: /kick [id/name][reason]");
if(PlayerInfo[playerid][pAdmin] >= 4) return SendClientMessage(playerid, {FF0000}, "[Warning]:You are not an Admin level 4!");
else if(id==playerid)SendClientMessage(playerid, {FF0000}, "Error: You can not kick yourself!");
else if(id==IsPlayerAdmin(id))SendClientMessage(playerid, {FF0000}, "Error: You can not kick another admin!");
else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid, {FF0000}, "Error: Player is not connected!");
else
{
new Name[MAX_PLAYER_NAME], KickMessage[128];
new Name2[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(id, Name2, sizeof(Name2));
format(KickMessage, sizeof(KickMessage), "%s(%d) has kicked player %s(%d). Reason: %s", Name, playerid, Name2, id);
SendClientMessageToAll({FF0000}, KickMessage);
Kick(id);
}
return 1;
}
Re: Help with errors -
iRage - 17.05.2012
*Biggest facepalm in the world*
{FF0000} is used WITHIN the text string,
"This is text string and it's always between quotations."
COLOR_WHITE is used in the color slot which is before the text string.
SendClientMessage(playerid, color, "text");
SendClientMessageToAll(color, "text");
Re: Help with errors -
IvancheBG - 17.05.2012
I did what you said but sitll errors:
Код:
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : error 029: invalid expression, assumed zero
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : warning 215: expression has no effect
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1228) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1289) : warning 202: number of arguments does not match definition
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1289) : warning 202: number of arguments does not match definition
C:\Documents and Settings\^Taco_Khalifa^\Desktop\server samp\gamemodes\testserver.pwn(1289) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Re: Help with errors -
MichaelProPlayer - 17.05.2012
Open pawno ---> open the script ---> press Ctrl+G then type 1289 and 1228 and show me those two lines
Re: Help with errors -
Kitten - 17.05.2012
pawn Код:
CMD:kick(playerid, params[])
{
new id, reason[128];
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, -1, "Usage: /kick [id/name][reason]");
else if(id == playerid)SendClientMessage(playerid, -1, "Error: You can not kick yourself!");
else if(id == IsPlayerAdmin(id))SendClientMessage(playerid, -1, "Error: You can not kick another admin!");
else if (id == INVALID_PLAYER_ID)SendClientMessage(playerid, -1 ,"Error: Player is not connected!");
else
{
new Name[MAX_PLAYER_NAME], KickMessage[128];
new Name2[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
GetPlayerName(id, Name2, sizeof(Name2));
format(KickMessage, sizeof(KickMessage), "%s(%d) has kicked player %s(%d). Reason: %s", Name,id,reason);
SendClientMessageToAll(-1, KickMessage);
Kick(id);
}
}
else {
SendClientMessage(playerid, -1, "[Warning]:You are not an Admin level 4!");
}
return 1;
}
Re: Help with errors -
IvancheBG - 17.05.2012
this command works thanks but the sethp dont...
Код:
CMD:sethp(playerid, params[])
{
new string[128], playa, health;
if(sscanf(params, "ud", playa, health))
{
SendClientMessage(playerid, -1, "{FF0000}USAGE: /sethp [playerid] [health]");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
SetPlayerHealth(playa, health);
format(string, sizeof(string), "{FF0000}You have set %s's health to %d.", GetPlayerName(playa), (health);
SendClientMessage(playerid, -1, string);
}
}
else SendClientMessage(playerid, -1, "{FF0000}Invalid player specified.");
}
else
{
SendClientMessage(playerid, -1, "{FF0000}You are not authorized to use that command!");
}
return 1;
}
Re: Help with errors -
IvancheBG - 17.05.2012
Someone ??