25.08.2017, 02:48
Olб, preciso saber como faзo para forзar um ID aleatoriamente para outra classe apуs acabar um timer global setado em on gamemodeinit.
CMD:forcarprof(playerid, params[])
{
new targetid;
if(APlayerData[playerid][PlayerLevel] < 2) return SendClientMessage(playerid, 0xFFFFFFFF, "{ff0000}Vocк nгo tem permissгo para usar este comando!");
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Uso: /forcarprof [ID]");
ForceClassSelection(targetid);
SetPlayerHealth(targetid, 0.0);
SendClientMessage(playerid, 0xFFFFFFFF, "{a9c4e4}Jogador forзado a escolher outra profissгo!");
SendClientMessage(targetid, 0xFFFFFFFF, "{a9c4e4}Vocк foi forзado a escolher outra profissao!");
SetPlayerHealth(targetid, 0);
return 1;
}
new count;
for(new i = 0; i < MAX_PLAYERS; i++) If(IsPlayerConnected(i)) count++;
new rand = 1+random(count);
count = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
count++;
if(count == rand)
{
//Forзar jogador i
break;
}
}
}
|
Код:
CMD:forcarprof(playerid, params[])
{
new targetid;
if(APlayerData[playerid][PlayerLevel] < 2) return SendClientMessage(playerid, 0xFFFFFFFF, "{ff0000}Vocк nгo tem permissгo para usar este comando!");
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Uso: /forcarprof [ID]");
ForceClassSelection(targetid);
SetPlayerHealth(targetid, 0.0);
SendClientMessage(playerid, 0xFFFFFFFF, "{a9c4e4}Jogador forзado a escolher outra profissгo!");
SendClientMessage(targetid, 0xFFFFFFFF, "{a9c4e4}Vocк foi forзado a escolher outra profissao!");
SetPlayerHealth(targetid, 0);
return 1;
}
|
|
PHP код:
|