SA-MP Forums Archive
bankrob - 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: bankrob (/showthread.php?tid=154049)



bankrob - Kar - 12.06.2010

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


Re: bankrob - TTJJ - 12.06.2010

What do you mean by "One Checkpoint Only"?


Re: bankrob - cessil - 12.06.2010

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



Re: bankrob - Kar - 12.06.2010

Код:
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?


Re: bankrob - (SF)Noobanatior - 12.06.2010

Код:
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


Re: bankrob - Kar - 12.06.2010

when theres 1 it sends 2 when theres 2 it sends 2..


Re: bankrob - DJDhan - 12.06.2010

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