OnPlayerRequestSpawn problem - 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: OnPlayerRequestSpawn problem (
/showthread.php?tid=611388)
OnPlayerRequestSpawn problem - Quinncell - 05.07.2016
So lately I've developed a CnR Points system.What this does for e.g if you have 1000 CnRP you are able to join classes that require 1000 CnRP or less.I wrote the code, compiles fine but even if I have the requested CnRP for the class I can't join it and btw the error message wont appear too.Does anyone have any ideas how to fix it?
PHP код:
public OnPlayerRequestSpawn(playerid)
{
switch(pInfo[playerid][Class])
{
case CLASS_FBI:
{
if(pInfo[playerid][CnRP] > 10000)
{
SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}10,000 CnR Points to join the FBI class");
return 1;
}
}
case CLASS_CIA:
{
if(pInfo[playerid][CnRP] > 15000)
{
SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}15,000 CnR Points to join the CIA class");
return 1;
}
}
case CLASS_MILITARY:
{
if(pInfo[playerid][CnRP] > 25000)
{
SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}20,000 CnR Points to join the Military class");
return 1;
}
}
}
return 1;
}
Re: OnPlayerRequestSpawn problem - Quinncell - 05.07.2016
Bump
Re: OnPlayerRequestSpawn problem -
Napst34 - 05.07.2016
Use return 0; instead of return 1;
Returning 0 will prevent the player from spawning and will send the error message.
Re: OnPlayerRequestSpawn problem -
Napst34 - 05.07.2016
Код:
public OnPlayerRequestSpawn(playerid)
{
switch(pInfo[playerid][Class])
{
case CLASS_FBI:
{
if(pInfo[playerid][CnRP] > 10000)
{
SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}10,000 CnR Points to join the FBI class");
return 0;
}
}
case CLASS_CIA:
{
if(pInfo[playerid][CnRP] > 15000)
{
SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}15,000 CnR Points to join the CIA class");
return 0;
}
}
case CLASS_MILITARY:
{
if(pInfo[playerid][CnRP] > 25000)
{
SendClientMessage(playerid, -1, "{AA3333}[ERROR] {FFFFFF}You must have {FFFF00}20,000 CnR Points to join the Military class");
return 0;
}
}
}
return 1;
}
Just like this.
Re: OnPlayerRequestSpawn problem - Quinncell - 05.07.2016
Thanks, can't believe I didn't return 0;
Re: OnPlayerRequestSpawn problem -
Napst34 - 05.07.2016
Ahaha good luck