Little Help Needed ! -
Avi57 - 13.07.2012
Guys i have this code of OnPlayerRequestClass :
Код:
public OnPlayerRequestClass(playerid, classid)
{
PlayerPlaySound(playerid,1097,1955.8129,-2181.6062,13.5865);
SetPlayerPos(playerid,2480.3538,1870.8656,24.3753);
SetPlayerCameraPos(playerid,2473.7202,1870.9253,25.7971);
SetPlayerCameraLookAt(playerid,2480.3538,1870.8656,24.3753);
SetPlayerFacingAngle(playerid,86.9258);
switch(classid)
{
case 0..6:
{
GameTextForPlayer(playerid,"~g~~h~Trucker",2500,3);
gTeam[playerid] = TEAM_TRUCKERS;
}
case 7:
{
GameTextForPlayer(playerid,"~r~Assistance",2500,3);
gTeam[playerid] = TEAM_ASSISTANCE;
}
case 8..14:
{
GameTextForPlayer(playerid,"~b~Police",2500,3);
gTeam[playerid] = TEAM_POLICE;
}
case 15..19:
{
GameTextForPlayer(playerid,"~g~~h~Taxi driver",2500,3);
gTeam[playerid] = TEAM_DRIVER;
}
case 20..23:
{
GameTextForPlayer(playerid,"~p~~h~Others",2500,3);
gTeam[playerid]= TEAM_RAPIST;
}
}
return 1;
}
and For OnPlayerRequestSpawn :
Код:
public OnPlayerRequestSpawn(playerid)
{
if(GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 284 || GetPlayerSkin(playerid) == 286 || GetPlayerSkin(playerid) == 288)
{
if(GetPlayerScore(playerid) < 50)
{
GameTextForPlayer(playerid,"~r~~h~100~b~score needed!",3000,3);
SendClientMessage(playerid,red,"» You need at least "lgrey"100"lred" score to be a cop!");
}
return 0;
}
return 1;
}
Can anyone Just add two things ?
1. Add a score req. system for my Assistance Class : 20 Scores
2. Add a score requirement system for my Taxi Class : 50 Scores !
Thanks
Re: Little Help Needed ! -
zT KiNgKoNg - 13.07.2012
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if(GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 284 || GetPlayerSkin(playerid) == 286 || GetPlayerSkin(playerid) == 288)
{
if(GetPlayerScore(playerid) > 100)
{
GameTextForPlayer(playerid,"~r~~h~100~b~score needed!",3000,3);
SendClientMessage(playerid,red,"» You need at least "lgrey"100"lred" score to be a cop!");
return 0;
}
}
return 1;
}
Re: Little Help Needed ! -
Cxnnor - 13.07.2012
Don't forget the score enumerator.
pawn Код:
enum pInfo
{
pScore[playerid],
// Etc.
}
Switch the returns around.
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
if(GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 284 || GetPlayerSkin(playerid) == 286 || GetPlayerSkin(playerid) == 288)
{
if(GetPlayerScore(playerid) > 100)
{
GameTextForPlayer(playerid,"~r~~h~100~b~score needed!",3000,3);
SendClientMessage(playerid,red,"» You need at least "lgrey"100"lred" score to be a cop!");
return 1;
}
}
return 0;
}
Re: Little Help Needed ! -
Avi57 - 13.07.2012
whats this ? i already have it !
Please read the question again ! i need same for Taxi and Assistance Class !
Thanks
Re: Little Help Needed ! -
Cxnnor - 13.07.2012
Tutorial for teams here and next time post it in the script request thread.
Re: Little Help Needed ! -
clarencecuzz - 13.07.2012
Don't return 0 on OnPlayerRequestSpawn, otherwise you won't be able to spawn with any other classes!
Re: Little Help Needed ! -
Avi57 - 13.07.2012
not worked !
please can anyone add them in it ?
Re: Little Help Needed ! -
leonardo1434 - 13.07.2012
You're using the wrong function.
Onplayerrequestspawn is called when a player spawn, so it is wrong. The function should be OnPlayerRequestClass, this one is called when the players is selecting their skins. so your command is supposed to be something like this:
pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
if(GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 284 || GetPlayerSkin(playerid) == 286 || GetPlayerSkin(playerid) == 288)// if the player has one of these skins.
{
if(GetPlayerScore(playerid) < 100)// if the player has of score less than 100.
{
GameTextForPlayer(playerid,"~r~~h~100~b~score needed!",3000,3); // This message will be displayed.
SendClientMessage(playerid,red,"» You need at least "lgrey"100"lred" score to be a cop!"); // This message will be displayed.
return 0;// And it will return 0; in others word, he won't spawn.
}
}
return 1; // always keep returning true at onplayerrequestclass otherwise he won't spawn.
}
By the way, instead of get them by skins, you should do it by classes if you already got it.
Re: Little Help Needed ! -
clarencecuzz - 13.07.2012
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(GetPlayerSkin(playerid) == 280 || GetPlayerSkin(playerid) == 281 || GetPlayerSkin(playerid) == 282 || GetPlayerSkin(playerid) == 283 || GetPlayerSkin(playerid) == 284 || GetPlayerSkin(playerid) == 286 || GetPlayerSkin(playerid) == 288)
{
if(GetPlayerScore(playerid) < 100)
{
GameTextForPlayer(playerid,"~r~~h~100~b~score needed!",3000,3);
SendClientMessage(playerid,red,"» You need at least "lgrey"100"lred" score to be a cop!"); // This message will be displayed.
return 0;
}
}
return 1;
}
OnPlayerRequestSpawn could also be used in this manner, just fixing up the above poster's code however.
Re: Little Help Needed ! -
leonardo1434 - 13.07.2012
my bad, i forgot to add his params. anyways the command is fine now.