SA-MP Forums Archive
force class selection help [URGENT} - 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: force class selection help [URGENT} (/showthread.php?tid=593255)



force class selection help [URGENT} - Commands - 03.11.2015

PHP код:
CMD:force(playeridparams[])
{
    new 
targetidsendername[MAX_PLAYER_NAME], receivername[MAX_PLAYER_NAME];
    if(
sscanf(params"u"targetid)) return SendClientMessage(playerid0xAFAFAFAA"USAGE: /force (playerid)");
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xAFAFAFAA"ERROR : Only RCON Admins can use the command");
    
GetPlayerName(playeridreceivernamesizeof(receivername));
    
GetPlayerName(playeridsendernamesizeof(sendername));
    
format(stringSOS"You have been forced into class selection by Admin %s"receivername);
    
SendClientMessage(targetidgreenstring);
    
format(stringSOS"You have forced %s into class selection"sendername);
    
SendClientMessage(playeridgreenstring);
    
ForceClassSelection(playerid);
    return 
1;

But IG everything is executed and displayed even the messages. Just the player doesn't get spawned or forced into class Selection. Any help ?


Re: force class selection help [URGENT} - MarcGonzales - 03.11.2015

The player will not return to class selection until they re-spawn. This can be achieved with TogglePlayerSpectating, as seen in the below example.

source: https://sampwiki.blast.hk/wiki/ForceClassSelection


Re: force class selection help [URGENT} - SecretBoss - 03.11.2015

Код:
CMD:force(playerid, params[])
{
    new targetid, sendername[MAX_PLAYER_NAME], receivername[MAX_PLAYER_NAME];
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xAFAFAFAA, "USAGE: /force (playerid)");
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "ERROR : Only RCON Admins can use the command");
    GetPlayerName(playerid, receivername, sizeof(receivername));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, SOS, "You have been forced into class selection by Admin %s", receivername);
    SendClientMessage(targetid, green, string);
    format(string, SOS, "You have forced %s into class selection", sendername);
    SendClientMessage(playerid, green, string);
    ForceClassSelection(targetid);
    SetPlayerHealth(targetid, 0.0);
    return 1;
}