SA-MP Forums Archive
Object... - 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: Object... (/showthread.php?tid=180030)



Object... - Libra_PL - 29.09.2010

Hey, this is my command:

Код:
dcmd_chp(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] > 4)
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        hiddenpackage = CreateObject(1210,x+2.0,y+1.0,z,0,0,0);
        SendClientMessage(playerid,yellow,"You have succesfully created a Hidden Package!");
        SendClientMessage(playerid,yellow,"Now you can use command /say or /announce to tell others about Hidden Package!");
        SendClientMessage(playerid,yellow,"Remember, create one Hidden Package costs 2,500 score...");
        SetPlayerScore(playerid, GetPlayerScore(playerid) - 2500);
    }
    return 1;
}
When I put a package two times, only one destroyes (using DestroyObject). So, can you help me and add here "cannot make a 2nd Hidden Package if one is created" thing, thx for anwser.


Re: Object... - The_Moddler - 29.09.2010

On top:
pawn Код:
new created[MAX_PLAYERS];
Command:
pawn Код:
dcmd_chp(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] > 4)
    {
        if(created[playerid] != 0) return SendClientMessage(playerid, yellow, "You can only create one Hidden Package!");
        else
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        created[playerid] = 1;
        hiddenpackage = CreateObject(1210,x+2.0,y+1.0,z,0,0,0);
        SendClientMessage(playerid,yellow,"You have succesfully created a Hidden Package!");
        SendClientMessage(playerid,yellow,"Now you can use command /say or /announce to tell others about Hidden Package!");
        SendClientMessage(playerid,yellow,"Remember, create one Hidden Package costs 2,500 score...");
        SetPlayerScore(playerid, GetPlayerScore(playerid) - 2500);
    }
    return 1;
}
It should work