public OnPlayerRequestSpawn(playerid) { new playername[MAX_PLAYER_NAME]; if(gTeam[playerid]==Team_Cops) // POLICE { if(strcmp(playername,"LVC_Chrham2",false)==0) { SendClientMessage(playerid,COLOR_BLUE,"Welcome to you, Police Officer! You are now on duty and you must do your best to protect Chrham's City!"); return 1; } else { SendClientMessage(playerid,COLOR_BLUE,"Only cops who have applied at the forums can spawn."); SendClientMessage(playerid,COLOR_BLUE,"http://chrhamrpg.one-forum.net/businesses-f6/"); return 0; } } if(gTeam[playerid]==Team_FBI) // FBI { if(strcmp(playername,"LVC_Chrham2",false)==0) { SendClientMessage(playerid,COLOR_BLUE,"Welcome to you, FBI Officer! You are now on duty and you must do your best to protect Chrham's City!"); return 1; } else { SendClientMessage(playerid,COLOR_BLUE,"Only FBI Officers who have applied at the forums can spawn."); SendClientMessage(playerid,COLOR_BLUE,"http://chrhamrpg.one-forum.net/businesses-f6/"); return 0; } } if(gTeam[playerid]==Team_Army) // ARMY { if(strcmp(playername,"LVC_Chrham2",false)==0) { SendClientMessage(playerid,COLOR_BLUE,"Welcome to you guy in the army! You must do your best to protect Chrham's City!"); return 1; } else { SendClientMessage(playerid,COLOR_BLUE,"Only armys who have applied at the forums can spawn."); SendClientMessage(playerid,COLOR_BLUE,"http://chrhamrpg.one-forum.net/businesses-f6/"); return 0; } } else { return 1; } }
Originally Posted by Ben^
if(strcmp(playername,"LVC_Chrham2",false)==1)
|
public OnPlayerRequestSpawn(playerid)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
if(gTeam[playerid]==Team_Cops) // POLICE
{
if(strcmp(playername,"LVC_Chrham2",false)==0)
{
SendClientMessage(playerid,COLOR_BLUE,"Welcome to you, Police Officer! You are now on duty and you must do your best to protect Chrham's City!");
return 1;
}
else
{
SendClientMessage(playerid,COLOR_BLUE,"Only cops who have applied at the forums can spawn.");
SendClientMessage(playerid,COLOR_BLUE,"[url]http://chrhamrpg.one-forum.net/businesses-f6/"[/url]);
return 0;
}
}
if(gTeam[playerid]==Team_FBI) // FBI
{
if(strcmp(playername,"LVC_Chrham2",false)==0)
{
SendClientMessage(playerid,COLOR_BLUE,"Welcome to you, FBI Officer! You are now on duty and you must do your best to protect Chrham's City!");
return 1;
}
else
{
SendClientMessage(playerid,COLOR_BLUE,"Only FBI Officers who have applied at the forums can spawn.");
SendClientMessage(playerid,COLOR_BLUE,"[url]http://chrhamrpg.one-forum.net/businesses-f6/"[/url]);
return 0;
}
}
if(gTeam[playerid]==Team_Army) // ARMY
{
if(strcmp(playername,"LVC_Chrham2",false)==0)
{
SendClientMessage(playerid,COLOR_BLUE,"Welcome to you guy in the army! You must do your best to protect Chrham's City!");
return 1;
}
else
{
SendClientMessage(playerid,COLOR_BLUE,"Only armys who have applied at the forums can spawn.");
SendClientMessage(playerid,COLOR_BLUE,"[url]http://chrhamrpg.one-forum.net/businesses-f6/"[/url]);
return 0;
}
} else {
return 1;
}
}
Originally Posted by David.
if(!strfind(playername,"LVC_Chrham2",false)) { ...
|
Originally Posted by Cezar
Your Code is correct except one thing is missing (Ben^ : strcmp returns 0 if the strings match. He did it correctly .).
Now what you did wrong is the you forgot to use "GetPlayerName" function. You created a string were to store it but you forgot to actually use the function. A small correction and it should work: pawn Код:
https://sampwiki.blast.hk/wiki/Strcmp - Definition of strcmp https://sampwiki.blast.hk/wiki/GetPlayerName - Definition of GetPlayerName |