SA-MP Forums Archive
[HELP] /Adsetscore - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] /Adsetscore (/showthread.php?tid=313580)



[HELP] /Adsetscore - James Coral - 26.01.2012

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?


Re: [HELP] /Adsetscore - Bogdan1992 - 26.01.2012

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;




Re: [HELP] /Adsetscore - James Coral - 26.01.2012

Код:
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?


Re: [HELP] /Adsetscore - Bogdan1992 - 26.01.2012

I fixed it. Copy paste again the code.


Re: [HELP] /Adsetscore - MP2 - 26.01.2012

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;
}



Re: [HELP] /Adsetscore - James Coral - 26.01.2012

Thanks :P

Can you make /admins command too?

then i give you REP


Re: [HELP] /Adsetscore - Bogdan1992 - 26.01.2012

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.


Re: [HELP] /Adsetscore - MP2 - 26.01.2012

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


Re: [HELP] /Adsetscore - James Coral - 26.01.2012

Bogdan1992 Send me /admins code please :P


Re: [HELP] /Adsetscore - Konstantinos - 26.01.2012

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(..);