SA-MP Forums Archive
Can someone edit easy code? - 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: Can someone edit easy code? (/showthread.php?tid=386506)



Can someone edit easy code? - MatZZPL - 20.10.2012

Hi everyone, i'm going to explain it quick and simple soo.. This is a code to degrade someone..
PHP код:
if(strcmp(cmd"/makeciv"true) == 0)
{
    if(
IsPlayerConnected(playerid)) {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp)) {
            
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /makeciv [playerid/PartOfName] ");
            return 
1;
        }
        new 
para1;
        
para1 ReturnUser(tmp);
        
tmp strtok(cmdtextidx);
         if (
RankRequire(playerid)) {
            if(
PlayerInfo[playerid][pMember] == 1) {
            if(
IsPlayerConnected(para1)) {
                if(
para1 != INVALID_PLAYER_ID) {
                 if(
PlayerInfo[para1][pGuard] == 1) {
                    
GetPlayerName(para1giveplayersizeof(giveplayer));
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
GiveNameSpace(sendername);
                    
GiveNameSpace(giveplayer);
                    
PlayerInfo[para1][pGuard] = 0;
                    
PlayerInfo[para1][pModel] = 47;
                    
SetPlayerSkinEx(para1,47);
                    
format(stringsizeof(string), "   You have been demoted to a regular civilian by: %s"sendername);
                    
SendClientMessage(para1COLOR_WHITEstring);
                    
format(stringsizeof(string), "You have been demoted %s to a regular civilian"giveplayer);
                    
SendClientMessage(playeridCOLOR_WHITEstring);
                    }
                    }
                }
            }                                     
//not connected
        
}
        else {
            
SendClientMessage(playeridCOLOR_GRAD1"   you are not authorized to use that command!");
        }
    }
    return 
1;

I tried to edit this 100's of time but keep on failing. What im trying to do is edit this so that a [pMember] == 20 can edit someones driving licence which is [pDrivLic] and set the value to 1.

I know how to to do it in ZCMD, but this is completely different and i need to use this

Could anyone edit this for me and explain how he did it? Would be very thankful and obviously +rep for help


Re: Can someone edit easy code? - MatZZPL - 20.10.2012

anyone pleasee?


Re : Can someone edit easy code? - Varkoll_ - 20.10.2012

PHP код:
if(strcmp(cmd"/givedrivelicense"true) == 0)
{
    if(
IsPlayerConnected(playerid)) {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp)) {
            
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /givedrivelicense [playerid/PartOfName] ");
            return 
1;
        }
        new 
para1;
        
para1 ReturnUser(tmp);
        
tmp strtok(cmdtextidx);
         if (
RankRequire(playerid)) {
            if(
PlayerInfo[playerid][pMember] == 20) {
            if(
IsPlayerConnected(para1)) {
                if(
para1 != INVALID_PLAYER_ID) {
                    
PlayerInfo[para1][pDrivLic] = 1;
                    
format(stringsizeof(string), "   %s give you a drive license"sendername);
                    
SendClientMessage(para1COLOR_WHITEstring);
                    
format(stringsizeof(string), "You give drive license to %s"giveplayer);
                    
SendClientMessage(playeridCOLOR_WHITEstring);


                    }
                }
            }                                     
//not connected
        
}
        else {
            
SendClientMessage(playeridCOLOR_GRAD1"   you are not authorized to use that command!");

        }
    }
    return 
1;

Like that ?

Rep+ if i help you


Re: Can someone edit easy code? - MatZZPL - 20.10.2012

Thank you very much, i'm going to test it right now and +rep


Re : Can someone edit easy code? - Varkoll_ - 20.10.2012

So, does it work?