Object...
#1

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.
Reply
#2

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)