[Question] Random Event - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Question] Random Event (
/showthread.php?tid=118653)
[Question] Random Event -
fsnameless - 04.01.2010
i want to make it so if the player is in a checkpoint it will give them a random amount of money varying from 25k to 50k
ive already searched and didnt find anything useful
Re: [Question] Random Event -
Correlli - 04.01.2010
pawn Код:
if(IsPlayerInCheckpoint(playerid)) GivePlayerMoney(playerid, randomEx(25000, 50000));
pawn Код:
stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
/* i think this function is created by ******, but i'm not sure. */
Re: [Question] Random Event -
fsnameless - 05.01.2010
ok well that didnt work for what i was trying to do heres my code
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(CPS_IsPlayerInCheckpoint(playerid, testrob))
{
SendClientMessage(playerid, white, "Type: /robstore");
}
return 1;
}
stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/robstore", true)==0)
{
if(CPS_IsPlayerInCheckpoint(playerid, testrob))
GivePlayerMoney(playerid, randomEx(25000, 50000));
}
else
{
SendClientMessage(playerid,white,"Sorry Your Not In A Store.");
}
return 1;
}
Re: [Question] Random Event -
SiJ - 05.01.2010
Quote:
|
Originally Posted by FS}Nameless [LDR
]
ok well that didnt work for what i was trying to do heres my code
pawn Код:
public OnPlayerEnterCheckpoint(playerid) { if(CPS_IsPlayerInCheckpoint(playerid, testrob)) { SendClientMessage(playerid, white, "Type: /robstore"); } return 1; }
stock randomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/robstore", true)==0) { if(CPS_IsPlayerInCheckpoint(playerid, testrob)) { GivePlayerMoney(playerid, randomEx(25000, 50000)); } } else { SendClientMessage(playerid,white,"Sorry Your Not In A Store."); } return 1; }
|
Re: [Question] Random Event -
fsnameless - 05.01.2010
ok why you quote me but not say anything your post is pointless
Re: [Question] Random Event -
MadeMan - 05.01.2010
Quote:
|
Originally Posted by FS}Nameless [LDR
]
ok well that didnt work for what i was trying to do
|
What do you mean didn't work? Did you get the money?
Re: [Question] Random Event -
fsnameless - 05.01.2010
no the command didnt do anything i got the SendClientMessage to work but not the cmd it just did nothing so idk whats wrong
Re: [Question] Random Event -
MadeMan - 05.01.2010
Do you want to give the money when player types /robstore or when he enters the checkpoint?
Re: [Question] Random Event -
Correlli - 05.01.2010
Quote:
|
Originally Posted by FS}Nameless [LDR
]
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/robstore", true)==0) { if(CPS_IsPlayerInCheckpoint(playerid, testrob)) GivePlayerMoney(playerid, randomEx(25000, 50000)); } else { SendClientMessage(playerid,white,"Sorry Your Not In A Store."); } return 1; }
|
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/robstore", true) == 0)
{
if(CPS_IsPlayerInCheckpoint(playerid, testrob)) GivePlayerMoney(playerid, randomEx(25000, 50000));
else SendClientMessage(playerid, white, "Sorry Your Not In A Store.");
return 1;
}
return 0;
}
Re: [Question] Random Event -
fsnameless - 06.01.2010
still dont work idk why it doesnt