PDA

View Full Version : Give Gift block


Beljulji
02/11/2012, 07:44 AM
CMD:getgift(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 10, -1549.7174,582.2617,7.1797))return SendClientMessage(playerid, COLOR_YELLOW,"You are not near any xmas tree.");
{
new rand = random(4);
switch(rand)
{
case 0: GivePlayerMoney(playerid, 5139525);
case 1: GivePlayerWeapon(playerid, 31, 200);
case 2: SetPlayerSkin(playerid, 264);
default: SendClientMessage(playerid, COLOR_YELLOW,"You found a present");
}
}
return 1;
}
how i can make so players cant type that command in next 30 minutes?

iJumbo
02/11/2012, 07:53 AM
CMD:getgift(playerid, params[])
{
if(GetPVarInt(playerid,"GiftRequest")>GetTickCount()) return SendClientMessage(playerid, COLOR_YELLOW,"You can use this command every 30 minutes");
if(IsPlayerInRangeOfPoint(playerid, 10, -1549.7174,582.2617,7.1797))return SendClientMessage(playerid, COLOR_YELLOW,"You are not near any xmas tree.");
{
new rand = random(4);
switch(rand)
{
case 0: GivePlayerMoney(playerid, 5139525);
case 1: GivePlayerWeapon(playerid, 31, 200);
case 2: SetPlayerSkin(playerid, 264);
default: SendClientMessage(playerid, COLOR_YELLOW,"You found a present");
SetPVarInt(playerid,"GiftRequest",GetTickCount()+1800000);
}
}
return 1;
}

Beljulji
02/11/2012, 07:58 AM
C:\Users\Beljulji\Documents\Samp Server\filterscripts\[MV]_Christmas1.2.pwn(945) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Beljulji\Documents\Samp Server\filterscripts\[MV]_Christmas1.2.pwn(945) : warning 215: expression has no effect
C:\Users\Beljulji\Documents\Samp Server\filterscripts\[MV]_Christmas1.2.pwn(947) : warning 209: function "cmd_getgift" should return a value
C:\Users\Beljulji\Documents\Samp Server\filterscripts\[MV]_Christmas1.2.pwn(948) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

iJumbo
02/11/2012, 08:00 AM
wich lines of code are ?

Beljulji
02/11/2012, 08:04 AM
http://img252.imageshack.us/img252/4851/37701115.png

iJumbo
02/11/2012, 08:05 AM
try this


new getgiftCcount[MAX_PLAYERS];
CMD:getgift(playerid, params[])
{
if(getgiftCcount[playerid] > GetTickCount()) return SendClientMessage(playerid, COLOR_YELLOW,"You can use this command every 30 minutes");
if(IsPlayerInRangeOfPoint(playerid, 10, -1549.7174,582.2617,7.1797))return SendClientMessage(playerid, COLOR_YELLOW,"You are not near any xmas tree.");
{
new rand = random(4);
switch(rand)
{
case 0: {
GivePlayerMoney(playerid, 5139525);
}
case 1: {
GivePlayerWeapon(playerid, 31, 200);
}
case 2: {
SetPlayerSkin(playerid, 264);
}
default: {
SendClientMessage(playerid, COLOR_YELLOW,"You found a present");
}
}
getgiftCcount[playerid] = GetTickCount() + 1800000;
}
return 1;
}


then if work try the case n: function like you do :)

Beljulji
02/11/2012, 08:09 AM
now works but tree is in sf and i am in ls and says i found present LOL

iJumbo
02/11/2012, 08:11 AM
you take the correct position on IsPlayerInRange.. ?
try use 10.0 and not 10 for range

Beljulji
02/11/2012, 08:12 AM
oh yeah i was thinking that now too let me check :D

Beljulji
02/11/2012, 08:14 AM
well doesnt say that im not near tree and when i type cmd again i cant use it 30 minutes WTF? LOL

iJumbo
02/11/2012, 08:18 AM
the default is not for every case .. you haver to put you found a present for every case and you get a message for every case of present

have you tryed to get the correct position?

Beljulji
02/11/2012, 08:25 AM
can you pls help me i didnt sleep this night so i cant think :)

iJumbo
02/11/2012, 08:30 AM
go sleep so you can think better lol

i don't know why not work .. for me is the wrong pos <.<

Beljulji
02/11/2012, 08:36 AM
well if i go sleep will be same tomorow,
what position should be right?

cosbraa
02/11/2012, 08:44 AM
make it !IsPlayerInRangeOfPoint, so it checks if they aren't and sends message saying they aren't near the Xmas tree

iJumbo
02/11/2012, 08:45 AM
oh right