30.12.2017, 22:30
Hello!
I'm have a code:
Problems is:
1.When i'm type /getgift,checkpoint is placed in center of the map[Why?]
2.When i'm type /getgift and i'm near i'm not reward nothing.
I'm have a code:
Код:
dcmd_getgift(playerid, params[]) { #pragma unused params new Float:gx, Float:gy, Float:gz, string[256], string1[256], string2[256], string4[256], string5[256], name[60]; new randompp = random(35); GetPlayerName(playerid, name, 60); new randommoney = random(750000); new randomxp = random(20); GetObjectPos(19056, gx, gy, gz); new ghours = GetPlayerGiftHours(playerid); new nhours = 3 - ghours; if(AccountInfo[playerid][Hours] <= 2) return SCM(playerid, ERROR, "Trebuie sa ai cel putin 2 ore jucate pentru a putea participa la GiftBox"); format(string, sizeof(string), "Vei putea deschide din nou giftbox-ul peste %i ore", nhours); if(AccountInfo[playerid][GiftHours] == 2 && AccountInfo[playerid][GiftHours] == 0) return SCM(playerid, COLOR_YELLOW, string); else if(AccountInfo[playerid][GiftHours] == 1) return SCM(playerid, COLOR_YELLOW, "Vei putea deschide din nou giftbox-ul peste o ora"); if(!IsPlayerInRangeOfPoint(playerid, 4, gx, gy, gz)) return SetPlayerCheckpoint(playerid, gx, gy, gz, 2); SCM(playerid, ERROR, "Nu esti in locatia potrivita,ti-am pus un checkpoint pe radar"); if(!IsPlayerConnected(playerid)) return SCM(playerid, ERROR, "Trebuie sa fii conectat pentru a putea participa la giftbox!"); else { new randgift = random(5); switch (randgift) { case 0: { format(string1, sizeof(string1), "Felicitari,ai castigat %i PremiumPoints din GiftBox!", randompp); SCM(playerid, COLOR_YELLOW, string1); AccountInfo[playerid][PremiumPoints] += randompp; format(string2, sizeof(string2), "{98AFC7}(( %s a castigat %i PremiumPoints din GiftBox! ))", name, randompp); SendClientMessageToAll(COLOR_YELLOW, string); AccountInfo[playerid][GiftHours] -= 3; } case 1: { format(string1, sizeof(string1), "Felicitari,ai castigat %i Experienta din GiftBox!", randomxp); SCM(playerid, COLOR_YELLOW, string1); AccountInfo[playerid][Exp] += randomxp; format(string2, sizeof(string2), "{98AFC7}(( %s a castigat %i Experienta din GiftBox! ))", name, randomxp); SendClientMessageToAll(COLOR_YELLOW, string); AccountInfo[playerid][GiftHours] -= 3; } case 2: { format(string1, sizeof(string1), "Felicitari,ai castigat LEVELUP din GiftBox!"); SCM(playerid, COLOR_YELLOW, string1); AccountInfo[playerid][Level] ++; format(string2, sizeof(string2), "{98AFC7}(( %s a castigat LEVELUP din GiftBox! ))", name); SendClientMessageToAll(COLOR_YELLOW, string2); AccountInfo[playerid][GiftHours] -= 3; } case 3: { format(string5, sizeof(string5), "Felicitari,ai castigat %i$ din GiftBox!", randommoney); SCM(playerid, COLOR_YELLOW, string5); format(string4, sizeof(string4), "{98AFC7}(( %s a castigat %i$ din GiftBox! ))", name, randommoney); SendClientMessageToAll(COLOR_YELLOW, string4); GivePlayerMoney(playerid, randommoney); AccountInfo[playerid][GiftHours] -= 3; } } } return 1; }
1.When i'm type /getgift,checkpoint is placed in center of the map[Why?]
2.When i'm type /getgift and i'm near i'm not reward nothing.