SA-MP Forums Archive
Problem in Score Capping - 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: Problem in Score Capping (/showthread.php?tid=201732)



Problem in Score Capping - X35B - 22.12.2010

OK, i have this:

} else if(classid == 6) {
GameTextForPlayer(playerid,"~b~POLICE OFFICER",1000,5);
if(GetPlayerScore(playerid) < 500)
SendClientMessage(playerid, 0xFFFFFFFF, "You have to have atleast 500 score to be a police officer!");
SetPlayerHealth(playerid, 0);
} else if(classid == 7 ) {
GameTextForPlayer(playerid,"~r~TRUCKER PP",1000,5);
} else if(classid == {
...

But when i pick the Police Officer class i die, then i spawn again in that class as if i had 500 score.


Re: Problem in Score Capping - Sledge - 22.12.2010

use ForceClassSelection to bring you back to class selection.


Re: Problem in Score Capping - Grim_ - 22.12.2010

Why don't you just restrict them from spawning with OnPlayerRequestSpawn (by returning 0) instead of killing them?


Re: Problem in Score Capping - Sledge - 22.12.2010

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Why don't you just restrict them from spawning with OnPlayerRequestSpawn (by returning 0) instead of killing them?
i was going to say that but he ain't that good enough of a scripter.


Re: Problem in Score Capping - X35B - 22.12.2010

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Why don't you just restrict them from spawning with OnPlayerRequestSpawn (by returning 0) instead of killing them?
Because I don't know how to do that. L.O.L.


Re: Problem in Score Capping - X35B - 22.12.2010

I've got this:
} else if(classid == 6) {
GameTextForPlayer(playerid,"~b~POLICE OFFICER",1000,5);
if(GetPlayerScore(playerid) < 500)
SendClientMessage(playerid, 0xFFFFFFFF, "You have to have atleast 500 score to be a police officer!");
ForceClassSelection(playerid);
return 0;

EDIT: It shows the POLICE OFFICER text but not the actual class.


Re: Problem in Score Capping - Grim_ - 22.12.2010

pawn Код:
// Top of script
new pClass[ MAX_PLAYERS ]; // Adjust accordingly

public OnPlayerRequestSpawn( playerid )
{
   if( pClass[ playerid ] == 6 )
   {
      if( GetPlayerScore( playerid ) < 500 )
      {
         SendClientMessage( playerid, 0xFFFFFFFF, "You have to have at least 500 score to be a police officer!" );
         return 0;
      }
   }
   return 1;
}

public OnPlayerRequestClass( playerid, classid )
{
   pClass[ playerid ] = classid;
   return 1;
}



Re: Problem in Score Capping - X35B - 22.12.2010

public OnPlayerRequestSpawn( playerid )
{
if( pClass[ playerid ] == 6 )
{
if( GetPlayerScore( playerid ) < 500 )
{
SendClientMessage( playerid, 0xFFFFFFFF, "You have to have at least 500 score to be a police officer!" );
return 0;
}
}
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
pClass[ playerid ] = classid;
return 1;
}
SetupPlayerForClassSelection(playerid);

if(classid == 0) {

and i've got new pClass[ MAX_PLAYERS ]; where i've got all my other 'new's.

error 021: symbol already defined: "SetupPlayerForClassSelection"
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(473) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(475) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(477) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(479) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(481) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(483) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(485) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(487) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(489) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(492) : error 010: invalid function or declaration
C:\Users\Nicholas\Desktop\TruckersUnited\gamemodes \TruckersUnited.pwn(727) : warning 203: symbol is never used: "SetupPlayerForClassSelection"

Lines 473 to 492

473 if(classid == 0) {
GameTextForPlayer(playerid,"~b~TRUCKER",1000,5);
} else if(classid == 1) {
GameTextForPlayer(playerid,"~b~TRUCKER",1000,5);
} else if(classid == 2) {
GameTextForPlayer(playerid,"~b~TRUCKER",1000,5);
} else if(classid == 3) {
GameTextForPlayer(playerid,"~b~TRUCKER",1000,5);
} else if(classid == 4) {
GameTextForPlayer(playerid,"~b~TRUCKER",1000,5);
} else if(classid == 5) {
GameTextForPlayer(playerid,"~b~TRUCKER",1000,5);
} else if(classid == 7 ) {
GameTextForPlayer(playerid,"~r~TRUCKER PP",1000,5);
} else if(classid == {
GameTextForPlayer(playerid,"~r~TRUCKER",1000,5);
} else if(classid == 9) {
GameTextForPlayer(playerid,"~r~LV PILOT",1000,5);
}
492 return 1;


Re: Problem in Score Capping - Grim_ - 22.12.2010

You have messed something up. If you would PM me your script, or post it here, I or someone else will be able to fix it for you.