force class selection help [URGENT}
#1

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 ?
Reply
#2

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
Reply
#3

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)