[Question] Random Event
#1

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
Reply
#2

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. */
Reply
#3

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;
}
Reply
#4

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;
}
Reply
#5

ok why you quote me but not say anything your post is pointless
Reply
#6

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?
Reply
#7

no the command didnt do anything i got the SendClientMessage to work but not the cmd it just did nothing so idk whats wrong
Reply
#8

Do you want to give the money when player types /robstore or when he enters the checkpoint?
Reply
#9

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;
}
Reply
#10

still dont work idk why it doesnt
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)