SA-MP Forums Archive
[AJUDA] Comando de admin - 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] Comando de admin (/showthread.php?tid=261972)



[AJUDA] Comando de admin - mengueh - 15.06.2011

Olб, gostaria da ajuda de vocкs para fazer um comando /darscore [id da pessoa] [quantidade], vlw! :]


Re: [AJUDA] Comando de admin - Dark.Angel - 15.06.2011

pawn Код:
CMD:darscore(playerid,params[])
{
    static giveplayerid,iScore,AdminName[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME],string[256];
    if (sscanf(params,"ii",giveplayerid,iScore))
        return SendClientMessage(playerid,0xFF0000AA,"Digite: /darscore [ID do Jogador] [Quantia de Score]");
       
    if (!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid,0xFF0000AA,"Vocк nгo esta conectado com admin RCON");
       
    if (!IsPlayerConnected(giveplayerid))
        return SendClientMessage(playerid,0xFF0000AA,"Este jogador nгo esta conectado no servidor");
       
    if (iScore < 1 || iScore > 1000000)
        return SendClientMessage(playerid,0xFF0000AA,"Quantia de score invalida. Minimo 1 Maximo 1.000.000");

      GetPlayerName(playerid,AdminName,sizeof(AdminName));
      GetPlayerName(giveplayerid,pName,sizeof(pName));

    new pScore = GetPlayerScore(giveplayerid);
    SetPlayerScore(giveplayerid,pScore+iScore);
    format(string,256,"O RCON ADMIN %s(id:%i) setou o score do jogador %s(id:%i) para %i TOTAL: %i",AdminName,playerid,pName,giveplayerid,iScore,pScore+iScore);
    SendClientMessageToAll(0xFFFFFFAA,string);
    return true;
}
Espero ter ajudado =)


Re: [AJUDA] Comando de admin - mengueh - 15.06.2011

C:\Documents and Settings\Usuбrio\Desktop\Server gta\gamemodes\dm.pwn(174) : error 017: undefined symbol "darscore"
C:\Documents and Settings\Usuбrio\Desktop\Server gta\gamemodes\dm.pwn(177) : error 017: undefined symbol "sscanf"
C:\Documents and Settings\Usuбrio\Desktop\Server gta\gamemodes\dm.pwn(189) : warning 217: loose indentation
C:\Documents and Settings\Usuбrio\Desktop\Server gta\gamemodes\dm.pwn(192) : warning 217: loose indentation
C:\Documents and Settings\Usuбrio\Desktop\Server gta\gamemodes\dm.pwn(19 : warning 225: unreachable code
C:\Documents and Settings\Usuбrio\Desktop\Server gta\gamemodes\dm.pwn(19 : warning 217: loose indentation
C:\Documents and Settings\Usuбrio\Desktop\Server gta\gamemodes\dm.pwn(174) : warning 203: symbol is never used: "CMD"


Deu isso D:


Re: [AJUDA] Comando de admin - Ricop522 - 16.06.2011

pawn Код:
if(strcmp(cmd, "/darscore", true) == 0)
{
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Use /darscore id lvl");
   new giveplayerid = ReturnUser(tmp);
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Use /darscore id lvl");
   new score = strval(tmp);
   new AdminName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
   GetPlayerName(playerid,AdminName,sizeof(AdminName));
   GetPlayerName(giveplayerid,pName,sizeof(pName));
   new pScore = GetPlayerScore(giveplayerid);
   SetPlayerScore(giveplayerid,pScore+score);
   new string[0x3C*2];
   format(string,sizeof(string),"O RCON ADMIN %s(id:%i) setou o score do jogador %s(id:%i) para %i TOTAL: %i",AdminName,playerid,pName,giveplayerid,iScore,pScore+score);
    SendClientMessageToAll(0xFFFFFFAA,string);
    return 0x01;
}