strfind help
#1

For some reason, if the person has [CIA] in their name, and they spawn, they still don't get the message that says "You have spawned as an official Central Intelligence Agency clan member" any help?

Код:
       case 32..35: {
		 new name[ MAX_PLAYER_NAME ];
		 SetPlayerPos(playerid,2752.8835,-2513.6389,25.7914);
         SetPlayerCameraPos(playerid,2753.1050,-2519.0244,26.6926);
         SetPlayerCameraLookAt(playerid,2752.8835,-2513.6389,25.7914);
         SetPlayerFacingAngle(playerid,180.0);
		 GameTextForPlayer(playerid, "~y~[RESTRICTED] Central Intelligence Agency", 3000, 3);
         ApplyAnimation(playerid,"GYMNASIUM", "GYMshadowbox",4.0,1,1,1,1,1);
         if(strfind(name,"[CIA]",true) != -1)
		 {
			 SendClientMessage(playerid, HOODLUMS_COLOR, "You have spawned as an official Central Intelligence Agency clan member.");
			 return 1;
		 }
       }
Reply
#2

"name" is null because you don't get the player's name anywhere.
pawn Код:
new name[ MAX_PLAYER_NAME ];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if(strfind(name,"[CIA]",true) != -1)
...
Reply
#3

Hello!

Write it in the following way:
PHP код:
case 32..35:
{
    new 
name[MAX_PLAYER_NAME];
    
SetPlayerPos(playerid,2752.8835,-2513.6389,25.7914);
     
SetPlayerCameraPos(playerid,2753.1050,-2519.0244,26.6926);
      
SetPlayerCameraLookAt(playerid,2752.8835,-2513.6389,25.7914);
       
SetPlayerFacingAngle(playerid,180.0);
       
GameTextForPlayer(playerid,"~y~[RESTRICTED] Central Intelligence Agency",3000,3);
       
ApplyAnimation(playerid,"GYMNASIUM","GYMshadowbox",4.0,1,1,1,1,1);
       
GetPlayerName(playerid,name,sizeof name);
       if(
strfind(name,"[CIA]",true) != -1)
       {
           
SendClientMessage(playeridHOODLUMS_COLOR"You have spawned as an official Central Intelligence Agency clan member.");
         return 
1;
       }

You have forgot to read out the name with GetPlayerName.

Mencent
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)