CMD:jail(playerid, params[])
{
if(PlayerInfo[playerid][AdminLevel] >= 4)
{
new targetid, minutes; //define the player's name and the minutes of jailing
if(sscanf(params, "ri", targetid, minutes)) return SendClientMessage(playerid, -1,"Usage: /jail <playerid> <minutes>"); //detects the wrong params and show the usage
if(minutes <= 0 || minutes > 60) return SendClientMessage(playerid, -1, "Minutes can't be less than 0 or more than 60!"); //we won't let a player suffer more than 1 hour, and not less than 1 minute
if(targetid == playerid) return SendClientMessage(playerid, -1, "You can't jail yourself!"); //comment this line out, if you wanna test this command on yourself!
else
{
new str; //create a new string
format(str, sizeof(str), "Administrator %s has jailed %s for %d minutes!", Name(playerid), Name(targetid), minutes); //get the admin's name, the player's and show the minutes
SendClientMessageToAll(-1,str); //let everybody know what you did, this will send the message to everyone
JailTimer[targetid] = SetTimer("Unjail", minutes*60*1000, false); //now HERE we're setting the jailtimer from the variable created, it will calculate the milliseconds to seconds, multiplicated with the amount of minutes we gave
SetPlayerPos(targetid, 264.4176, 77.8930, 1001.0391); //Sets the player's position to the jail in LS
SetPlayerInterior(targetid, 6); //this will set the player's interior to an jail-interior
inJail[targetid] = true; //now, here we'll check, if the player's in jail, we'll set the value to "true", means that he IS in jail
GameTextForPlayer(targetid, "~p~JAILED", 10000, 6); //this is for decorating and writing a big "JAILED" for the player
PlayerPlaySound(targetid,1057,0.0,0.0,0.0); //that's also a small sound, for decoration
}
}
else return SendClientMessage(playerid, -1, "You have to be level 4 to use this command!"); //if he isn't allowed to use this command, send him this message
return 1;
}
.pwn(1925) : error 035: argument type mismatch (argument 1) .pwn(1925) : error 035: argument type mismatch (argument 1) .pwn(1925) : warning 215: expression has no effect .pwn(1925) : error 001: expected token: ";", but found ")" .pwn(1925) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
format(str, sizeof(str), "Administrator %s has jailed %s for %d minutes!", Name(playerid), Name(targetid), minutes); //get the admin's name, the player's and show the minutes
new str;
new str[91];
Change:
pawn Код:
pawn Код:
|
new str[144]; // 144 is the highest amount of characters that can be viewed for SendClientMessage
I cant see whats is messing this code. Can someone give me a hand here please?
Command: pawn Код:
Код:
.pwn(1925) : error 035: argument type mismatch (argument 1) .pwn(1925) : error 035: argument type mismatch (argument 1) .pwn(1925) : warning 215: expression has no effect .pwn(1925) : error 001: expected token: ";", but found ")" .pwn(1925) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. Код:
format(str, sizeof(str), "Administrator %s has jailed %s for %d minutes!", Name(playerid), Name(targetid), minutes); //get the admin's name, the player's and show the minutes |
CMD:jail(playerid,params[]) { if(PlayerInfo[playerid][LoggedIn] == 1) { if(PlayerInfo[playerid][Level] >= 4) { new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index); if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /jail [playerid] [minutes] [reason]"); new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; player1 = strval(tmp); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) { if(PlayerInfo[player1][Jailed] == 0) { GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname)); new jtime = strval(tmp2); if(jtime == 0) jtime = 9999; CMDMessageToAdmins(playerid,"JAIL"); PlayerInfo[player1][JailTime] = jtime*1000*60; JailPlayer(player1); Jail1(player1); PlayerInfo[player1][Jailed] = 1; if(jtime == 9999) { if(!strlen(params[strlen(tmp2)+1])) format(string,sizeof(string),"Administrator %s has jailed %s ",adminname, playername); else format(string,sizeof(string),"[JAIL] Administrator %s sent %s to jail. Reason: %s",adminname, playername, params[strlen(tmp)+1] ); } else { if(!strlen(tmp3)) format(string,sizeof(string),"[JAIL] Administrator %s sent %s to jail for %d minutes",adminname, playername, jtime); else format(string,sizeof(string),"[JAIL] Administrator %s sent %s to jail for %d minutes. Reason: %s",adminname, playername, jtime, params[strlen(tmp2)+strlen(tmp)+1] ); } return SendClientMessageToAll(0xFF00FFFF,string); } else return SendClientMessage(playerid, red, "Player is already in jail"); } else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); } else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands"); }