[HELP] /Adsetscore
#1

Hey guys i want do make /adsetscore

i useing this admin system:

pawn Код:
if(AdminLevel[playerid] == 1)
and i useing Sscanf too so i make you for easy

Someone?
Reply
#2

PHP код:
CMD:adsetscoreplayeridparams[ ] ){
new 
idscoreNam[MAX_PLAYER_NAME], mystring[128];
    if(!( 
AdminLevel[playerid] == ))
        return 
0;
    if ( 
sscanfparams"ud"idscore) )
        return 
SendClientMessageplayerid, -1"USAGE: /adsetscore [ID] [score]" );
     else if( 
playerid== INVALID_PLAYER_ID )
         return 
SendClientMessageplayerid, -1"SYSTEM: {FFFFFF}That player is offline." );
      
GetPlayerNameidNamsizeof Nam );
    
formatmystringsizeof mystring"* You have set %s's score to %d."Namscore );
    
SendClientMessageplayeridCOLOR_REDmystring );
    
SetPlayerScoreidscore);
    return 
1;

Reply
#3

Код:
C:\Users\eesti\Desktop\test1\CRP\gamemodes\SFCRRPG.pwn(6271) : error 017: undefined symbol "giveplayerid"
C:\Users\eesti\Desktop\test1\CRP\gamemodes\SFCRRPG.pwn(6274) : error 017: undefined symbol "mystring"
C:\Users\eesti\Desktop\test1\CRP\gamemodes\SFCRRPG.pwn(6274) : error 017: undefined symbol "mystring"
C:\Users\eesti\Desktop\test1\CRP\gamemodes\SFCRRPG.pwn(6275) : error 017: undefined symbol "mystring"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
How do fix them?
Reply
#4

I fixed it. Copy paste again the code.
Reply
#5

Sorry but, that code is terrible.

pawn Код:
CMD:adsetscore(playerid, params[])
{
    new id, score, Nam[MAX_PLAYER_NAME], mystring[128];
    if(!AdminLevel[playerid]) return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin.");
    if (sscanf( params, "ud", id, score) ) return SendClientMessage( playerid, -1, "USAGE: /adsetscore [ID] [score]" );
    GetPlayerName(id, Nam, sizeof(Nam));
    format(mystring, sizeof mystring, "* You have set %s's score to %i.", Nam, score);
    SendClientMessage( playerid, COLOR_RED, mystring);
    SetPlayerScore(id, score);
    return 1;
}
Reply
#6

Thanks :P

Can you make /admins command too?

then i give you REP
Reply
#7

What is so terrible at my code? Oh wait you just removed the
PHP код:
else if( playerid== INVALID_PLAYER_ID 
         return 
SendClientMessageplayerid, -1"SYSTEM: {FFFFFF}That player is offline." ); 
And you added a return at if(adminblablabl). Btw its not a smart thing to revealyour commands by using that msg.
Reply
#8

Yes, because sscanf checks that. Also, the 'indentation' (more like pile-up) is un-readable.
Reply
#9

Bogdan1992 Send me /admins code please :P
Reply
#10

playerid is the player that type the command, so it's impossible to be offline. Change it to
pawn Код:
if( id == INVALID_PLAYER_ID) return SendClientMessage(..);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)