Why not working?
#1

I have these lines for /selldrugs,

but when i type it with the playerid nothing happens, is there smtg wrong?

PHP код:
if(strcmp(cmd"/selldrugs"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pJob] != 2)
            {
                
SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[ERROR:] You are not a drugs dealer!");
                return 
1;
            }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[USAGE:] /selldrugs [playerid] [amount]");
                return 
1;
            }
            new 
playa;
            new 
needed;
            
playa ReturnUser(tmp);
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) { return 1; }
            
needed strval(tmp);
            if(
needed || needed 50) { SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[ERROR:] 1-50 only."); return 1; }
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) { return 1; }
            if(
needed PlayerInfo[playerid][pDrugs]) { SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[ERROR:] You don't have that much!"); return 1; }
            if(
IsPlayerConnected(playa))
            {
                if(
playa != INVALID_PLAYER_ID)
                {
                    if (
ProxDetectorS(8.0playeridplaya))
                    {
                        if(
playa != playerid)
                        {
                            
format(stringsizeof(string), "[INFO:] You have gave %s %d grams of drugs."GetPlayerNameEx(playa), needed);
                            
SendClientMessage(playeridCOLOR_LIGHTYELLOW2string);
                            
format(stringsizeof(string), "[INFO:] %s has just gave you %d grams of drugs."GetPlayerNameEx(playerid), needed);
                            
SendClientMessage(playaCOLOR_LIGHTYELLOW2string);
                            
PlayerInfo[playa][pDrugs] += needed;
                            
PlayerInfo[playerid][pDrugs] -= needed;
                            
PlayerPlayerActionMessage(playerid,playa,15.0,"has just gave some drugs to");
                        }
                        else
                        {
                            
SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[ERROR:] You can't sell yourself drugs!");
                        }
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[ERROR:] You arn't near that player!");
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_LIGHTYELLOW2"[ERROR:] Invalid ID.");
            }
        }
        return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)