Errors in /warns -
DerickClark - 08.02.2013
Код:
C:\Users\pawno\include\PPC_PlayerCommands.inc(1524) : error 017: undefined symbol "playerWarn"
C:\Users\pawno\include\PPC_PlayerCommands.inc(1524) : warning 215: expression has no effect
C:\Users\pawno\include\PPC_PlayerCommands.inc(1524) : error 001: expected token: ";", but found "]"
C:\Users\pawno\include\PPC_PlayerCommands.inc(1524) : error 029: invalid expression, assumed zero
C:\Users\pawno\include\PPC_PlayerCommands.inc(1524) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Код:
// Warn a player
CMD:warn(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "Only admins can use this command.");
new pID, str[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
if(sscanf(params, "u", pID))
return SendClientMessage(playerid, -1, "Usage: /warn [Player ID]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "Selected player is not connected.");
playerWarn[pID] ++;
GetPlayerName(playerid, pName, sizeof pName);
GetPlayername(pID, name, sizeof name);
format(str, sizeof str, "Admin %s warned you. Total warnings %i.", pName, playerWarn[pID]);
SendClientMessage(pID, -1, str);
format(str, sizoef str, "You warned player %s. Total warnings %i.", name, playerWarn[pID]);
SendClientMessage(playerid, -1, str);
if(playerWarn[pID] > 2)
{
format(str, sizeof str, "%s accumulated 3 warnings and got kicked from the server.", name);
SendClientMessageToAll(-1, str);
SendClientMessage(pID, -1, "You were warned three (3) times and got kicked.");
Kick(pID);
}
return 1;
}
Re: Errors in /warns -
antonio112 - 08.02.2013
I told you in the script request thread, to create a new player variable called playerWarn ...
pawn Код:
// On top of your script, under #includes
new playerWarn[MAX_PLAYERS];
Here's the original post:
http://forum.sa-mp.com/showpost.php?...49&postcount=9
Re: Errors in /warns -
DerickClark - 08.02.2013
Код:
C:\Users\pawno\include\PPC_PlayerCommands.inc(1526) : error 017: undefined symbol "GetPlayername"
C:\Users\pawno\include\PPC_PlayerCommands.inc(1526) : warning 202: number of arguments does not match definition
C:\Users\Derick\Desktop\Natural Trucking\pawno\include\PPC_PlayerCommands.inc(1529) : error 017: undefined symbol "sizoef"
C:\Users\Derick\Desktop\Natural Trucking\pawno\include\PPC_PlayerCommands.inc(1529) : warning 215: expression has no effect
C:\Users\Derick\Desktop\Natural Trucking\pawno\include\PPC_PlayerCommands.inc(1529) : warning 215: expression has no effect
C:\Users\Derick\Desktop\Natural Trucking\pawno\include\PPC_PlayerCommands.inc(1529) : warning 215: expression has no effect
C:\Users\Derick\Desktop\Natural Trucking\pawno\include\PPC_PlayerCommands.inc(1529) : warning 215: expression has no effect
C:\Users\pawno\include\PPC_PlayerCommands.inc(1529) : error 001: expected token: ";", but found ")"
C:\Users\pawno\include\PPC_PlayerCommands.inc(1529) : error 029: invalid expression, assumed zero
C:\Users\pawno\include\PPC_PlayerCommands.inc(1529) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
i put that in.
Re: Errors in /warns -
blackdragon1 - 08.02.2013
PHP код:
CMD:warn(playerid, params[])
{
new id;
if(IsPlayerConnected(id))
{
if(!IsPlayerAdmin(playerid))
{
if(!sscanf(params, "u", id))
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "You have been warned by %s ", name);
SendClientMessage(id, 0xD8D8D8FF, string);
format(string, sizeof(string), "You have warn %s ", PlayerName);
SendClientMessage(playerid, 0xD8D8D8FF, string);
PlayerInfo[playerid][pWarns] = PlayerInfo[playerid][pWarns] +1;
return 1;
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /warn [PlayerId/PartOfName]");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not allowed to use this command.");
}
else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
not tested. try it.
Re: Errors in /warns -
antonio112 - 08.02.2013
blackdragon1, you have absolutely no idea what you're doing, do you?
How can you check if 'id' is connected, if you haven't even defined what's that 'id' yet?
pawn Код:
CMD:warn(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "Only admins can use this command.");
new pID, str[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
if(sscanf(params, "u", pID))
return SendClientMessage(playerid, -1, "Usage: /warn [Player ID]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "Selected player is not connected.");
playerWarn[pID] ++;
GetPlayerName(playerid, pName, sizeof pName);
GetPlayerName(pID, name, sizeof name);
format(str, sizeof str, "Admin %s warned you. Total warnings %i.", pName, playerWarn[pID]);
SendClientMessage(pID, -1, str);
format(str, sizeof str, "You warned player %s. Total warnings %i.", name, playerWarn[pID]);
SendClientMessage(playerid, -1, str);
if(playerWarn[pID] > 2)
{
format(str, sizeof str, "%s accumulated 3 warnings and got kicked from the server.", name);
SendClientMessageToAll(-1, str);
SendClientMessage(pID, -1, "You were warned three (3) times and got kicked.");
Kick(pID);
}
return 1;
}
Try this ... It should work.