SA-MP Forums Archive
help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help (/showthread.php?tid=268587)



help - stix - 13.07.2011

I want to know what's wrong with this command, when i type /sell and any of the options which is mp3, wallet, cellphone and creditcard it says unknown command

I know this is the problem :

}
SendClientMessage(playerid,RED, "You don't have a MP3.");

}
SendClientMessage(playerid,RED, "You don't have a Cellphone.");
}
SendClientMessage(playerid,RED, "You don't have a Wallet.");
}
SendClientMessage(playerid,RED, "You don't have a Credit-card.");
}
}

But what is the correct formula ?


pawn Код:
if(strcmp(cmd,"/sell",true)==0)
    {
    if(!IsPlayerInRangeOfPoint(playerid, 1.5 , 2379.1194,-655.6750,127.8510)) return SendClientMessage(playerid,RED, " You are not at the black market. ");
    {
    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /sell [wallet/cellphone/creditcard/mp3]");
    {
    if(PlayerData[playerid][MP3] == 1)
    {
    if(!strcmp(tmp,"mp3"))
    {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][MP3] = 0;
        GivePlayerMoney(playerid, 200);
        SendClientMessage(playerid, YELLOW, " You have sold the black market a credit card for 200$ American Dollars");
        return 1;
        }
    if(PlayerData[playerid][Cellphone] == 1)
    {
    if(!strcmp(tmp,"cellphone"))
        {
        PlayerData[playerid][Cellphone] = 0;
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        GivePlayerMoney(playerid, 250);
        SendClientMessage(playerid, YELLOW, " You have sold the black market a credit card for 250$ American Dollars");
        return 1;
        }
    if(PlayerData[playerid][Wallet] == 1)
    {
    if(!strcmp(tmp,"wallet"))
        {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][Wallet] = 0;
        GivePlayerMoney(playerid, 400);
        SendClientMessage(playerid, YELLOW, " You have sold the black market a credit card for 400$ American Dollars");
        return 1;
        }
    if(PlayerData[playerid][Creditcard] == 1)
    {
    if(!strcmp(tmp,"Creditcard"))
        {
        SetTimer("illegaljob", 1000*1200, false); // Set a timer of 1000 miliseconds (1 second)
        PlayerData[playerid][Creditcard] = 0;
        GivePlayerMoney(playerid, 400);
        SendClientMessage(playerid, YELLOW, " You have sold the black market a credit card for 400$ American Dollars");
        return 1;
        }
        else
        {
        SendClientMessage(playerid, RED, " You didn't type a right item-name.");
        }
    return 1;
    }
 }
    SendClientMessage(playerid,RED, "You don't have a MP3.");
   
 }
    SendClientMessage(playerid,RED, "You don't have a Cellphone.");
 }
    SendClientMessage(playerid,RED, "You don't have a Wallet.");
 }
    SendClientMessage(playerid,RED, "You don't have a Credit-card.");
 }
 }



Re: help - Godhimself - 13.07.2011

Why are you checking if it "Is not" the string found?

Try changing

!strcmp

to

strcmp


Re: help - PrawkC - 13.07.2011

Quote:
Originally Posted by Godhimself
Посмотреть сообщение
Why are you checking if it "Is not" the string found?

Try changing

!strcmp

to

strcmp
You're very wrong, when comparing strings if it is equal to 0 then it matches, thus him doing !strcmp would mean if it is equal to 0.

edit; I'm pretty sure the timers are causing it, can you post the "illegaljob" function ?


Re: help - stix - 13.07.2011

forward illegaltime(playerid);

public illegaltime(playerid)
{
SendClientMessage(playerid, RED, "ANNOUNCE: 2 hours has passed away, you're able to do an illegal job again.");
PlayerData[playerid][illegaljob] = 0;
}

i dont think is this because the timer works for other illegal jobs, only at /sell command

as i said before i think its the

}
}
}

but idk which isu the right formula


Re: help - stix - 13.07.2011

so ?