GiftBox Problems
#2

Your code is stroke inducing, you might as well rewrite it instead of taking the time to debug. For example, you are doing something wrong if you have 6 strings (string1, string2...) with 256 characters, same goes for the rest of the variables. I only skimmed the code but you can probably just have one string (probably not even needing 256 cells in the first place). You can reuse strings, only reason to create more is if you don't want to rewrite the other one for further usage.

Secondly, you initialize ghour and nhour variables, both unneeded really as they're used literally once. Just do it in-line, so instead of doing:
pawn Код:
format(string, sizeof(string), "Vei putea deschide din nou giftbox-ul peste %i ore", nhours);
You can simply:
pawn Код:
format(string, sizeof(string), "Vei putea deschide din nou giftbox-ul peste %i ore", 3 - GetPlayerGiftHours(playerid));
You also initialize this at the top, despite them each being used in one case:
pawn Код:
new randommoney = random(750000);
    new randomxp = random(20);
These can go under the respective case blocks. The same thing goes for randgift, simply use switch(5), no need for the variable.

Another problem is you're checking if the player is connected. Ofcourse they are, who else typed the command? (unless you called the function manually, but still, validity checks could go elsewhere).

DCMD also isn't the best command processor, but that's for another day.

As for the actual issue, 19056 is not the object ID, but the model ID. You need the ID returned from CreateObject.
Reply


Messages In This Thread
GiftBox Problems - by Longover - 30.12.2017, 22:30
Re: GiftBox Problems - by Abagail - 30.12.2017, 23:03
Re: GiftBox Problems - by Sew_Sumi - 30.12.2017, 23:06
Re: GiftBox Problems - by RoboN1X - 30.12.2017, 23:32
Re: GiftBox Problems - by Sew_Sumi - 31.12.2017, 01:01
Re: GiftBox Problems - by Longover - 31.12.2017, 14:50

Forum Jump:


Users browsing this thread: 1 Guest(s)