Help command - 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: Help command (
/showthread.php?tid=661061)
Help command -
Spawe - 20.11.2018
How do I do the following? Instead of kicking you to the warning 3/3, i sent you to coordinates (jail)
PHP код:
public KickTimer(playerid)
{
Kick(playerid);
return 1;
}
CMD:warn(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new giveplayerid, reason[50];
if(sscanf(params, "us[50]", giveplayerid, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "Correct usage: /warn [playerid/name] [reason]");
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
new string[150], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME];
GetPlayerName(playerid, sender, sizeof(sender));
GetPlayerName(giveplayerid, receiver, sizeof(receiver));
format(string, sizeof(string), "%s (%d) was warned by %s (%d), reason: %s (%d/3)", receiver, giveplayerid, sender, playerid, reason, Warns[giveplayerid]+1);
SendClientMessageToAll(0x00FFFFFF, string);
if(Warns[playerid] == 2)
{
format(string, sizeof(string), "%s (%d) was automatically kicked, reason: had 3 warnings", receiver, giveplayerid);
SendClientMessageToAll(0x00FFFFFF, string);
SetTimerEx("KickTimer", 1000, false, "i", giveplayerid);
}
else
{
Warns[giveplayerid] ++;
GameTextForPlayer(giveplayerid, "~r~warned~n~~w~check the chat", 5000, 6);
}
return 1;
}
Re: Help command -
ApolloScripter - 20.11.2018
if you want, create a command and place the code below to perform such action, or just put somewhere you want to use. Remember to replace (x, y, z) with the respective strings, and the playerid, for some variable that is storing the specific player's name or ID
pawn Код:
SetPlayerPos (playerid, x, y, z)
Re: Help command -
TitoRayne - 21.11.2018
remove this.
Re: Help command -
AzaMx - 21.11.2018
pawn Код:
public WarnJail(playerid)
{
PlayerStats[playerid][jail] = 1;
SetPlayerPos(playerid, x,y,z);
return 1;
}
if(Warns[playerid] == 2)
{
format(string, sizeof(string), "%s (%d) was automatically jailed, reason: had 3 warnings", receiver, giveplayerid);
SendClientMessageToAll(0x00FFFFFF, string);
// make something like this maybe?
SetTimerEx("WarnJail", 1000, false, "i", giveplayerid);
}
This is just example