Give Gift block - 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)
+--- Thread: Give Gift block (
/showthread.php?tid=389465)
Give Gift block -
Beljulji - 02.11.2012
Код:
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?
Re: Give Gift block -
iJumbo - 02.11.2012
pawn Код:
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;
}
Re: Give Gift block -
Beljulji - 02.11.2012
Код:
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 © 1997-2006, ITB CompuPhase
2 Errors.
Re: Give Gift block -
iJumbo - 02.11.2012
wich lines of code are ?
Re: Give Gift block -
Beljulji - 02.11.2012
Re: Give Gift block -
iJumbo - 02.11.2012
try this
pawn Код:
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
Re: Give Gift block -
Beljulji - 02.11.2012
now works but tree is in sf and i am in ls and says i found present LOL
Re: Give Gift block -
iJumbo - 02.11.2012
you take the correct position on IsPlayerInRange.. ?
try use 10.0 and not 10 for range
Re: Give Gift block -
Beljulji - 02.11.2012
oh yeah i was thinking that now too let me check
Re: Give Gift block -
Beljulji - 02.11.2012
well doesnt say that im not near tree and when i type cmd again i cant use it 30 minutes WTF? LOL