05.04.2011, 03:46
Your code hardly makes any sense. I'll point out the critical flaws for you to understand:
pawn Код:
COMMAND:jail(playerid, params[])
{
new id; // <-- You're declaring the variable, which by default is 0
if(IsPlayerConnected(id)) // <-- You're checking if ID 0 is connected, no matter what!
if(sscanf(params,"u", id))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /jail [id]"); // <-- Now you're getting the ID after it's too late...
//if(Jail[id] == 1) return SendClientMessage(playerid,red,"This user is already in jail!");
if(PlayerInfo[playerid][Admin] >= 1) // <-- This part is fine
{
GetPlayerName(playerid, Name, sizeof(Name)); // <-- Where did you declare 'Name'?
format(String, sizeof(String), "%s has jailed you",Name); // <-- Where did you declare 'String'?
SendClientMessage(id,green, String);
//Jail[id] = 1;
SetPlayerSkin(id, 62);
SetPlayerPos(id, 412.99816894531,2543.0656738281,26.244613647461);
SetPlayerColor(id,COLOR_GREEN);
format(String, sizeof(String), "You have jailed %s",Name);
SendClientMessage(playerid,green, String);
}
return 1;
}