Sziasztok!Kéne nekem egy olyan szkript, ami lekérdezi a játékosnak a nevét, annak is egy részletét. Ha pl. a nevében benne van az hogy [_7nG.], akkor használhassa azt a csapatot. A csapat: TEAM_RENDOR. Tehát ha benne van a nevébe az hogy [_7nG.] (lehet a neve pl. [_7nG.]Lali, [_7nG.]Pisti, [_7nG.]Gazsi.), akkor adja meg az engedélyt, hogy lespawnoljon a játékos (public OnPlayerRequestClass ha jól tudom). Elõre is köszönöm a válaszokat! A helyes megoldásért +-t adok!Köszönöm! :smokin:
public OnPlayerRequestClass(playerid, classid){ //Gondolom akkor vannak itt kódok, amik meghatározzák, hogy melyik class melyik csapaté, oda ezt new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if(strcmp(name, \"[_7nG.]\", false, 7)==0) //Ez a függvény 0-val tér vissza, ha az elsõ 7 karakter megegyezik ezekkel { return 1; } return 0; //Idáig ---------------------------------------------------------------------------------------------------------------------}
public OnPlayerRequestClass(playerid, classid){ switch(classid) { case 0: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 1: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 2: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 3: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 4: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 5: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 6: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 7: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 8: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 9: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 10: { gTeam[playerid] = TEAM_RENDOR; GameTextForPlayer(playerid, \"Rendõr\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 11: { gTeam[playerid] = TEAM_RENDOR; GameTextForPlayer(playerid, \"Rendõr\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 12: { gTeam[playerid] = TEAM_RENDOR; GameTextForPlayer(playerid, \"Rendõr\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 13: { gTeam[playerid] = TEAM_ADMIN; GameTextForPlayer(playerid, \"Admin\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 14: { gTeam[playerid] = TEAM_ADMIN; GameTextForPlayer(playerid, \"Admin\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } } return 1;}
public OnPlayerRequestClass(playerid, classid){ switch(classid) { case 0: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 1: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 2: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 3: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 4: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 5: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 6: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 7: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 8: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 9: { gTeam[playerid] = TEAM_CIVIL; GameTextForPlayer(playerid, \"Civil\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 10: { gTeam[playerid] = TEAM_RENDOR; GameTextForPlayer(playerid, \"Rendõr\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 11: { gTeam[playerid] = TEAM_RENDOR; GameTextForPlayer(playerid, \"Rendõr\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 12: { gTeam[playerid] = TEAM_RENDOR; GameTextForPlayer(playerid, \"Rendõr\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 13: { gTeam[playerid] = TEAM_ADMIN; GameTextForPlayer(playerid, \"Admin\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } case 14: { gTeam[playerid] = TEAM_ADMIN; GameTextForPlayer(playerid, \"Admin\", 1000, 4); SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2005.3905,1544.6749,13.5908);SetPlayerFacingAngle(playerid, 90.0);SetPlayerCameraPos(playerid,2001.6473,1545.0640,13.5859);SetPlayerCameraLookAt(playerid,2005.3905,1544.6749,13.5908); } } if(gTeam[playerid]==TEAM_RENDOR) //Az elõzõekben beállitotta a class-okhoz a csapatokat ugye, és itt pedig leellenõrzi, hogy rendõrt választott-e { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); //Új \"name\" változó és abba a játékos neve if(strcmp(name, \"[_7nG.]\", false, 7)==0) //Ez a függvény 0-val tér vissza, ha az elsõ 7 karakter megegyezik ezekkel { return 1; //Ekkor engedélyezett a spawn. } return 0; //Különben nem } return 1; //Ha nem rendõr, akkor is engedélyezett}