help {REP+] - 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 {REP+] (
/showthread.php?tid=336486)
help {REP+] -
sanplayer - 22.04.2012
Thsi code crashes my server when used.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s gone AFK, they will not respond until they are back", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
SendClientMessage(playerid, 0x00FF22, "You've gone AFK please type /back when your back");
return 1;
}
if (strcmp("/back", cmdtext, true, 10) == 0)
{
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s are back, They will now respond!", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
SendClientMessage(playerid, 0x00FF22, "Welcome Back, %s");
return 1;
}
return 0;
}
Also, How to make it freeze you on /afk and unfreeze on /back?
Re: help {REP+] -
spedico - 22.04.2012
doesn't crash + freezes the player:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/afk", true))
{
new pname[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s gone AFK, they will not respond until they are back", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, 0x00FF22, "You've gone AFK please type /back when your back");
return 1;
}
if(!strcmp(cmdtext, "/back", true))
{
new pname[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s are back, They will now respond!", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
format(string, sizeof(string), "Welcome back, %s", pname);
SendClientMessage(playerid, 0x00FF22, string);
TogglePlayerControllable(playerid, 1);
return 1;
}
return 0;
}
Re: help {REP+] -
Twisted_Insane - 22.04.2012
Simply use "TogglePlayerControllable"....
https://sampwiki.blast.hk/wiki/TogglePlayerControllable
EDIT: Too late.
Re: help {REP+] -
sanplayer - 22.04.2012
Thanks. You Both Helped.
You both are getting rep