[Ajuda] AFK Sistema
#1

PHP код:
CMD:afk(playeridparams[])
{
    
SetPlayerPos(playerid322.197998,302.497985,999.148437);
    
SetPlayerInterior(playerid5);
    
SetPlayerHealth(playerid9999);
    
ResetPlayerWeapons(playerid);
    new 
string[64];
    
format(stringsizeof string"o Jogador (%s) Estб no /AFK"PlayerName(playerid));
    
SendClientMessageToAll(COR_ERROstring);
    else{
    
SpawnPlayer(playerid);
    
SetPlayerInterior(playerid0);
    
SetPlayerHealth(playerid100);
    
SetPlayerArmour(playerid100);
    
format(stringsizeof string"o Jogador (%s) Saiu Do AFK /sairafk"PlayerName(playerid));
    
SendClientMessageToAll(COR_ERROstring);
    }
    return 
1;

PHP код:
C:\Users\Usuario\Desktop\SV\gamemodes\TEST.pwn(930) : error 029invalid expressionassumed zero
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Error

Reply
#2

Quote:
Originally Posted by JuniorTheDM
Посмотреть сообщение
PHP код:
CMD:afk(playeridparams[])
{
    
SetPlayerPos(playerid322.197998,302.497985,999.148437);
    
SetPlayerInterior(playerid5);
    
SetPlayerHealth(playerid9999);
    
ResetPlayerWeapons(playerid);
    new 
string[64];
    
format(stringsizeof string"o Jogador (%s) Estб no /AFK"PlayerName(playerid));
    
SendClientMessageToAll(COR_ERROstring);
    else{
    
SpawnPlayer(playerid);
    
SetPlayerInterior(playerid0);
    
SetPlayerHealth(playerid100);
    
SetPlayerArmour(playerid100);
    
format(stringsizeof string"o Jogador (%s) Saiu Do AFK /sairafk"PlayerName(playerid));
    
SendClientMessageToAll(COR_ERROstring);
    }
    return 
1;

PHP код:
C:\Users\Usuario\Desktop\SV\gamemodes\TEST.pwn(930) : error 029invalid expressionassumed zero
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Error

\/\/\/\/\/\/\/
Reply
#3

PHP код:
new bool:AFK[MAX_PLAYERS];
CMD:afk(playerid)
{
    new 
string[64];
    if(!
AFK[playerid])
    {
        
SetPlayerPos(playerid322.197998,302.497985,999.148437);
        
SetPlayerInterior(playerid5);
        
SetPlayerHealth(playerid9999);
        
ResetPlayerWeapons(playerid);
        
AFK[playerid] = true;
        
format(stringsizeof string"o Jogador (%s) Estб no /AFK"PlayerName(playerid));
        
SendClientMessageToAll(COR_ERROstring);
    }
    else
    {
        
SpawnPlayer(playerid);
        
SetPlayerInterior(playerid0);
        
SetPlayerHealth(playerid100);
        
SetPlayerArmour(playerid100);
        
AFK[playerid] = false;
        
format(stringsizeof string"o Jogador (%s) Saiu Do AFK /sairafk"PlayerName(playerid));
        
SendClientMessageToAll(COR_ERROstring);
    }
    return 
1;

Reply
#4

Tente esse cуdigo acima, estava faltando uma variбvel no seu cуdigo, para verificar se o Player jб estava de AFK ou nгo, tambйm nгo precisa do uso do params, jб que nгo vai utilizar o mesmo.
Reply
#5

Se vocк quer utilizar o params, vocк pode fazer desse modo:

PHP код:
//Topo do GM:
new bool:IsPlayerAFK[MAX_PLAYERS];
CMD:afk(playeridparams[]) {
    if(
isnull(params)) return SendClientMessage(playerid,cor_vermelho,"/afk [on/off]");
    new 
string[64];
    if(!
strcmp(params,"on",true)) {
        
IsPlayerAFK[playerid] = true;
        
SetPlayerPos(playerid322.197998,302.497985,999.148437);
        
SetPlayerInterior(playerid5);
        
SetPlayerHealth(playerid9999);
        
ResetPlayerWeapons(playerid);
        
format(stringsizeof string"o Jogador (%s) Estб no /AFK"PlayerName(playerid));
        
SendClientMessageToAll(COR_ERROstring);
    else if(!
strcmp(params,"off",true)) {
        
IsPlayerAFK[playerid] = false;
        
SpawnPlayer(playerid);
        
SetPlayerInterior(playerid0);
        
SetPlayerHealth(playerid100);
        
SetPlayerArmour(playerid100);
        
format(stringsizeof string"o Jogador (%s) Saiu Do AFK /sairafk"PlayerName(playerid));
        
SendClientMessageToAll(COR_ERROstring);
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)