bankrob
#1

how do i make a /robbank command for 1 checkpoint only

this is my current robbank
Код:
if(strcmp(cmdtext, "/robbank", true) == 0) // If they type /robbank
{
	if(IsPlayerInCheckpoint(playerid)) // Check if they are in a checkpoint  <====tag mismatch it's corrected
  {
    new string[128];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    new cash = random(60000); // random number between 1 & 60000 is the money they will get
    GivePlayerMoney(playerid, cash); // Give the player the money!
    format(string,sizeof(string),"%s has just stolen %d from the bank!",playername,cash);
    SendClientMessageToAll(TEAL,string);
	}
	return 1;
}
and i wanna make it like for this cp only it says something diff and for other cps
Reply
#2

What do you mean by "One Checkpoint Only"?
Reply
#3

you need to set a variable to that checkpoint like at the top
Код:
new bankcp;
and then
Код:
bankcp = [part where you create the checkpoint]
Reply
#4

Код:
stock OnBankRob(playerid, bankid, amount) // this goes anywhere in the script outside of a callback or function
{
    new string[128], pNick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pNick, MAX_PLAYER_NAME);
    switch(bankid)
    {
        case LS_BANK: format(string, sizeof string, "%s (%d) has stolen $%d from The Los Santos Bank In Pershing Square!", pNick, playerid, amount);
    }
    SendClientMessageToAll(TEAL, string);
    return 1;
}
why does that send a client message 2 times?
Reply
#5

Код:
stock OnBankRob(playerid, bankid, amount) // this goes anywhere in the script outside of a callback or function
{
    new string[128], pNick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pNick, MAX_PLAYER_NAME);
    switch(bankid)
    {
        case LS_BANK: format(string, sizeof string, "%s (%d) has stolen $%d from The Los Santos Bank In Pershing Square!", pNick, playerid, amount);
    }
    SendClientMessage(playerid,TEAL, string);
    return 1;
}
cozz there is 1 othe player in your server
Reply
#6

when theres 1 it sends 2 when theres 2 it sends 2..
Reply
#7

If you call this function under OnPlayerStateChange then it will show the message two times, not otherwise.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)