SA-MP Forums Archive
[Ajuda] AFK Sistema - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] AFK Sistema (/showthread.php?tid=582875)



AFK Sistema - JuniorTheDM - 24.07.2015

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




Re: AFK Sistema - iMFear - 24.07.2015

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

\/\/\/\/\/\/\/


Re: AFK Sistema - Thider - 24.07.2015

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;




Re: AFK Sistema - Thider - 24.07.2015

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.


Re: AFK Sistema - s4kuL - 24.07.2015

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;