[HELP]Box Command - 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)
+--- Thread: [HELP]Box Command (
/showthread.php?tid=279811)
[HELP]Box Command -
[Aka]Dragonu - 29.08.2011
Hello. I made this simple command :
pawn Код:
if(strcmp(cmd,"/cashbox",true)==0)
{
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 105)
{
MissionActive = 1;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
}
return 1;
}
No errors when compiling, but when I enter in game and tipe /cashbox as admin nothing happens.
And the cashbox mission exists look :
pawn Код:
public OnGameModeMission()
{ if(pdebug == 1){print("[DEBUG] OnGameModeMission()");}
new string[128];
if(MissionActive == 1)
{
if(PlayerIsDoingMission == INVALID_PLAYER_ID)
{
ResetMissions();
new rcashbox;
if(city == 1){rcashbox = random(sizeof(RandomFindCashbox_LS));}
RandomCashboxMissionMoney = MinCashboxMissionMoney+random(MaxCashboxMissionMoney-MinCashboxMissionMoney);
if(city == 1){format(string, sizeof(string), "** Mission: Cashbox **: Find the cashbox at %s! Worth: %d$", RandomFindCashboxName_LS[rcashbox][0], RandomCashboxMissionMoney);
SendClientMessageToAll(COLOR_YELLOW, string);
}
new Float:ratio = 4.0;
for(new i=0; i<MAX_SLOTS; i++)
{
if(city == 1){SetPlayerCheckpoint(i, RandomFindCashbox_LS[rcashbox][0], RandomFindCashbox_LS[rcashbox][1], RandomFindCashbox_LS[rcashbox][2], ratio);}
}
if(city == 1){
CheckpointBusyX = RandomFindCashbox_LS[rcashbox][0];
CheckpointBusyY = RandomFindCashbox_LS[rcashbox][1];
CheckpointBusyZ = RandomFindCashbox_LS[rcashbox][2];
AllPlaySound(1139);
}
}
}
Re: [HELP]Box Command -
=WoR=Varth - 29.08.2011
I don't see any of your code inside your command calling OnGameModeMission.
Re: [HELP]Box Command -
[Aka]Dragonu - 29.08.2011
What? I don't understand can you repeat please?
Re: [HELP]Box Command -
=WoR=Varth - 29.08.2011
Where you call OnGameModeMission? With timer or what?
Re: [HELP]Box Command -
[MWR]Blood - 29.08.2011
As varthshenon just said, you are just setting the var to 1 in the command, so you can't expect anything to happen.
You have to call the callback you created (
OnGameModeMission()).
If you are calling it with a timer, you have to wait until it gets called.
Re: [HELP]Box Command -
[Aka]Dragonu - 29.08.2011
Yes, It's called with a timer. here it is
pawn Код:
SetTimer("OnGameModeMission", MISSION_LENGTH, true);
Re: [HELP]Box Command -
=WoR=Varth - 30.08.2011
Where is that?
And how long is MISSION_LENGTH?
Re: [HELP]Box Command -
PrawkC - 30.08.2011
What is PlayerIsDoingMission ?
Re: [HELP]Box Command -
[Aka]Dragonu - 30.08.2011
@varthshenon - #define MISSION_LENGTH 900000
@PrawkC - new PlayerIsDoingMission = INVALID_PLAYER_ID;
Re: [HELP]Box Command -
=WoR=Varth - 30.08.2011
pawn Код:
if(pdebug == 1){print("[DEBUG] OnGameModeMission()");
Does the string printed?