new Random;
#include <zcmd>
#include <a_samp>
#include <zcmd>
new Random;
COMMAND:gifts(playerid, params[])
{
// code here
return 1;
}
COMMAND:gifts(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
{
// Code here
}
return 1;
}
Random = random(3);
switch(Random)
{
case 0:
case 1:
case 2:
}
COMMAND:gifts(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
{
Random = random(3);
switch(Random)
{
case 0:
case 1:
case 2:
}
}
return 1;
}
#include <a_samp>
#include <zcmd>
new Random;
public OnFilterScriptInIt()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
COMMAND:gifts(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
{
Random = random(3);
switch(Random)
{
case 0:
case 1:
case 2:
}
}
return 1;
}
COMMAND:gifts(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
{
Random = random(3);
switch(Random)
{
case 0: // Let's add cash!
{
GivePlayerCash(playerid, 5000);
SendClientMessage(playerid, -1, "Santa Claus gifted you 5000$. Merry Christmas!");
}
case 1: // Let's add some score to the user!
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+15);
SendClientMessage(playerid, -1, "Santa Claus gifted you 15 score. Merry Christmas!");
}
case 2: // Let's gift him nothing, he was a bad boy this year.
{
SendClientMessage(playerid, -1, "You were in Santa Claus blacklist and he didn't even pass over your house. Be a good guy next year");
}
}
}
return 1;
}
#include <a_samp>
#include <zcmd>
new Random;
public OnFilterScriptInIt()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
COMMAND:gifts(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
{
Random = random(3);
switch(Random)
{
case 0: // Let's add cash!
{
GivePlayerCash(playerid, 5000);
SendClientMessage(playerid, -1, "Santa Claus gifted you 5000$. Merry Christmas!");
}
case 1: // Let's add some score to the user!
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+15);
SendClientMessage(playerid, -1, "Santa Claus gifted you 15 score. Merry Christmas!");
}
case 2: // Let's gift him nothing, he was a bad boy this year.
{
SendClientMessage(playerid, -1, "You were in Santa Claus blacklist and he didn't even pass over your house. Be a good guy next year");
}
}
}
return 1;
}
#include <a_samp>
#include <zcmd>
new Random;
new GotGifts[MAX_PLAYERS];
public OnPlayerConnect(playerid);
{
GotGifts[playerid] =0; // resets variable
return 1;
}
public OnFilterScriptInIt()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
COMMAND:gifts(playerid, params[])
{
if(GotGifts[playerid] == 1) return SendClientMessage(playerid, -1, "* You already have got your gift."); // gives error message if he got gift already...
if(IsPlayerInRangeOfPoint(playerid, Range, X, Y, Z))
{
GotGifts[playerid] =1; // "1" means he got gift.
Random = random(3);
switch(Random)
{
case 0: // Let's add cash!
{
GivePlayerCash(playerid, 5000);
SendClientMessage(playerid, -1, "Santa Claus gifted you 5000$. Merry Christmas!");
}
case 1: // Let's add some score to the user!
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+15);
SendClientMessage(playerid, -1, "Santa Claus gifted you 15 score. Merry Christmas!");
}
case 2: // Let's gift him nothing, he was a bad boy this year.
{
SendClientMessage(playerid, -1, "You were in Santa Claus blacklist and he didn't even pass over your house. Be a good guy next year");
}
}
}
return 1;
}
switch(random(3))
I know that it might be abused and I though to update it by using a timer to prevent it getting abused. Means, something like a timer for a hour so players must wait a hour to get gift.
|