/arrest and /plate commands - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /arrest and /plate commands (
/showthread.php?tid=347486)
/arrest and /plate commands -
darkvsoul36 - 02.06.2012
Hey guys and girls. I need some help with a /arrest command and a /plate command.
/arrest: I have no idea where to begin with this aside from
Код:
if (strcmp("/arrest", cmdtext, true) == 0)
I want the player to be put in ANY vehicle and ANY player can use this command. Some code and explanations would really help.
/plate: I wanted the players to be able to change their cars license plate. This will not be saved (yet) as it will only be used for when a player connects then disconnects. I have no idea where to start this whatsoever.
Keep in mind, I am a beginner script writer and I would love explanations on what to do. I spent a whole month trying to tackle these two commands (long time, right?) and I have no leads. Please help with a nudge in the right direction, code, and/or explanations. Thanks!
Re: /arrest and /plate commands -
Edward156 - 02.06.2012
Arrest command:
pawn Код:
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;
}
License Plate system:
https://sampwiki.blast.hk/wiki/SetVehicleNumberPlate
https://sampforum.blast.hk/showthread.php?tid=228620
I found these on ****** so next time do some searching.