19.10.2012, 08:13
can someone help me with arrest CMD becuse i could dont find one if it on ****** can u help
CMD:arrest(playerid,params[])
{
if(PlayerInfo[playerid][pMember] || PlayerInfo[playerid][pLeader]){
new id,time,reason[100],PlayerName[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME];
new string[128];
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"Invalid ID!");
if(sscanf(params,"uds",id,time,reason)) return SendClientMessage(playerid,-1,"USAGE: /arrest <id> <time> <reason>");
GetPlayerName(id,PlayerName,sizeof(PlayerName));
GetPlayerName(playerid,GPlayerName,sizeof(GPlayerName));
format(string,sizeof(string)," %s has arrested %s for %d, reason: %s ",GPlayerName,PlayerName,time,reason);
SetPlayerInterior(id, 3);
SetPlayerVirtualWorld(id, 10);
SetPlayerFacingAngle(id, 360.0);
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);
SetPlayerHealth(id, 9999999999.0);
ResetPlayerWeapons(id);
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);
}else{
return 0;
}
return 1;
}
CMD:arrest(playerid, params[]) { if(PlayerInfo[playerid][Fmember] == 1) { new toplayer; new jailtime; new price; if(!sscanf(params, "uii", toplayer, jailtime, price)) { if((jailtime >= 1 && jailtime <= 10)) { if(IsPlayerInRangeOfPoint(toplayer, 20.0, 221.9771, 121.3747, 999.0156)) { if(IsPlayerInRangeOfPoint(playerid, 20.0, 221.9771, 121.3747, 999.0156)) { new string[128]; new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(toplayer, PlayerName, sizeof(PlayerName)); format(string, sizeof(string), "You are jailed for %d days by %s!", jailtime * 60000, name); SCM(toplayer, COLOR_BLUE, string); SetPlayerPos(toplayer, 219.3402, 110.0057, 999.0156); SetPlayerInterior(toplayer, 10); ResetPlayerWeapons(toplayer); jailed[toplayer] = 1; SetTimerEx("unjail", jailtime * 60000, false, "i", toplayer); GivePlayerCash(toplayer, -price); PlayerInfo[toplayer][Suspect] = sus_no; SetPlayerColor(toplayer, COLOR_WHITE); } else return SendClientMessage(playerid, 0x2641FEAA, "You are not near the jail!"); } else return SendClientMessage(playerid, 0x2641FEAA, "No suspect near the jail!"); } else return SendClientMessage(playerid, 0x2641FEAA, "Jailtime cant be shorter then 1 or longer then 10"); } else return SendClientMessage(playerid, 0x2641FEAA, "USAGE: /arrest [Playername] [JailTime] [price]"); } else return SendClientMessage(playerid, 0x2641FEAA, "You are not a cop!"); return 1; }
xMCx:
1- What if he has his own gamemode, or another one then you are using? For example, the "PlayerInfo" variable may not exist, just like this "JailTimer". And what about the "Unjail" function? You didn't include that either. This won't just work. 2- You may not give untested code. And are you sure you didn't just copy this? You also don't know if he's using the standard OnPlayerCommandText callback, ZCMD, DCMD or YCMD. |
new JailTimer[MAX_PLAYERS];//add this in the top of ur script under includes