24.05.2009, 10:44
Hi!
I want to make a script, that searches a character in the name of the player, and returns with the number of the searched character. I have a RP gamemode, and I don't want to allow people to register with names that have more than 1 _ characters. In the basic gamemode, there's a script that don't allows the register with names without _ character, but you can register with names with any _ characters.
I tryed this, but I can't compile it:
Compiling:
I want to make a script, that searches a character in the name of the player, and returns with the number of the searched character. I have a RP gamemode, and I don't want to allow people to register with names that have more than 1 _ characters. In the basic gamemode, there's a script that don't allows the register with names without _ character, but you can register with names with any _ characters.
I tryed this, but I can't compile it:
Код:
public OnPlayerConnect(playerid) { new plname[MAX_PLAYER_NAME]; GetPlayerName(playerid, plname, sizeof(plname)); split(plname, playernamesplit, '_'); if(Security != 0) { SendClientMessage(playerid, COLOR_YELLOW, "Host has broken one of the Agreement rules, action has been taken."); Kick(playerid); return 1; } new namestring = strfind(plname, "_", true); if(namestring == -1) { SendClientMessage(playerid, COLOR_YELLOW2, "Immigration Department: Your name is not acceptable."); SendClientMessage(playerid, COLOR_YELLOW2, "Hint: Your name must be in the format Firstname_Lastname."); Kick(playerid); return 1; } else if(playernamesplit >= 2) { SendClientMessage(playerid, COLOR_YELLOW2, "Immigration Department: Your name is not acceptable."); SendClientMessage(playerid, COLOR_YELLOW2, "Hint: Your name must be in the format Firstname_Lastname."); Kick(playerid); return 1; } [...] return 1; }
Код:
C:\Documents and Settings\LTomi\My Documents\Server\gamemodes\rpg.pwn(2900) : error 033: array must be indexed (variable "playernamesplit") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
Sorry for my bad English.