/rob command errors - 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: /rob command errors (
/showthread.php?tid=470777)
/rob command errors -
Lunixx - 19.10.2013
ERRORS:
C:\Documents and Settings\LinesX\My Documents\PZG.pwn(1345) : error 029: invalid expression, assumed zero
C:\Documents and Settings\LinesX\My Documents\PZG.pwn(1345) : error 017: undefined symbol "cmd_rob"
C:\Documents and Settings\LinesX\My Documents\PZG.pwn(1345) : error 029: invalid expression, assumed zero
C:\Documents and Settings\LinesX\My Documents\PZG.pwn(1345) : fatal error 107: too many error messages on one line
pawn Код:
stock RandomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
stock randomEx(min, max)
{
new rand = random(max-min+1)+min;
return rand;
}
stock IsPlayerAt247RobPoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 6, -25.884498,-185.868988,1003.546875) || IsPlayerInRangeOfPoint(playerid, 6, 6.091179,-29.271898,1003.549438))
{ return true; }
return false;
}
stock IsPlayerAtBankRobPoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 6, 2315.952880,-1.618174,26.742187))
{ return true; }
return false;
}
stock DangerousWeapon(weaponid)
{
switch(weaponid)
{
case 25, 26, 27, 29, 30, 31, 33, 35: return true;
}
return false;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
CMD:rob( playerid, params[ ] )
{
if(!IsPlayerAt247RobPoint(playerid) || !IsPlayerAtBankRobPoint(playerid))
{
return SendClientMessage(playerid, -1, "You are not at 24/7 or bank ");
}
if(!DangerousWeapon(GetPlayerWeapon(playerid))
{
return SendClientMessage(playerid, -1, "You need a dangerous weapon");
}
new
type,
money = 0;
if(IsPlayerAt247RobPoint(playerid))
{
// Random money and give it to player ( 24/7
money = randomEx(1000,50000);
type = 1; // 24/7
}
else
{
// Random money and give it to player ( Bank )
money = randomEx(50,300000);
tpye = 2; // bank
}
GivePlayerMoney(playerid, money);
// U can use TogglePlayerControllable to frezee player and SetTimerEx/SetTimer to release player
foreach(Player, p)
{
if(playersData[p][pGroup] == 1)
{
if(type == 1)
{
SendClientMessage(p, -1, "Alarm to police ( 24/7 )");
}
else
{
SendClientMessage(p, -1, "Alarm to police ( bank )");
}
}
}
// Also u can use PlayAudioStreamForPlayer/SetPlayerWantedLevel to warning/wanted player and
SendClientMessage(playerid, -1, "Warning to player");
return 1;
}
return 0;
}
Re: /rob command errors -
DanishHaq - 19.10.2013
ZCMD commands
must be outside of callbacks.
pawn Код:
stock RandomEx(minnum = cellmin, maxnum = cellmax) return random(maxnum - minnum + 1) + minnum;
stock randomEx(min, max)
{
new rand = random(max-min+1)+min;
return rand;
}
stock IsPlayerAt247RobPoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 6, -25.884498,-185.868988,1003.546875) || IsPlayerInRangeOfPoint(playerid, 6, 6.091179,-29.271898,1003.549438))
{ return true; }
return false;
}
stock IsPlayerAtBankRobPoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 6, 2315.952880,-1.618174,26.742187))
{ return true; }
return false;
}
stock DangerousWeapon(weaponid)
{
switch(weaponid)
{
case 25, 26, 27, 29, 30, 31, 33, 35: return true;
}
return false;
}
CMD:rob( playerid, params[ ] )
{
if(!IsPlayerAt247RobPoint(playerid) || !IsPlayerAtBankRobPoint(playerid))
{
return SendClientMessage(playerid, -1, "You are not at 24/7 or bank ");
}
if(!DangerousWeapon(GetPlayerWeapon(playerid))
{
return SendClientMessage(playerid, -1, "You need a dangerous weapon");
}
new
type,
money = 0;
if(IsPlayerAt247RobPoint(playerid))
{
// Random money and give it to player ( 24/7
money = randomEx(1000,50000);
type = 1; // 24/7
}
else
{
// Random money and give it to player ( Bank )
money = randomEx(50,300000);
tpye = 2; // bank
}
GivePlayerMoney(playerid, money);
// U can use TogglePlayerControllable to frezee player and SetTimerEx/SetTimer to release player
foreach(Player, p)
{
if(playersData[p][pGroup] == 1)
{
if(type == 1)
{
SendClientMessage(p, -1, "Alarm to police ( 24/7 )");
}
else
{
SendClientMessage(p, -1, "Alarm to police ( bank )");
}
}
}
// Also u can use PlayAudioStreamForPlayer/SetPlayerWantedLevel to warning/wanted player and
SendClientMessage(playerid, -1, "Warning to player");
return 1;
}
You had it under OnPlayerCommandText. You don't need to have OnPlayerCommandText whatsoever after using ZCMD and converting all your existing commands from OnPlayerCommandText > ZCMD.