Szerző Téma: Játékosnév részlet lekérés  (Megtekintve 672 alkalommal)

Játékosnév részlet lekérés
« Dátum: 2013. február 05. - 17:06:17 »
0 Show voters
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:

Játékosnév részlet lekérés
« Válasz #1 Dátum: 2013. február 05. - 20:11:14 »
+1 Show voters
Idézetet írta: Spirit date=1360080377\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"33460\" data-ipsquote-contentclass=\"forums_Topic
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:
 
A spawnolás engedélyezéséhez/tiltásához az OnPlayerRequestSpawn kell, legalábbis szerintem idegesitõ lenne, ha váltogatás közben állandóan kiirná, hogy te ezt nem használhatod, és mondjuk átváltaná.
Régen Pawno-ztam már, az OnPlayerRequestClass-ban is le lehet tiltani.
Az összehasonlitáshoz pedig strcmp().
 

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 ---------------------------------------------------------------------------------------------------------------------
}

 
Addig nem tudok konkrétabbat irni, amig nem mutatod meg a kódod ezen részét, vagy irsz egy kicsit többet róla, hogy is mûködik.
E: Ja bocs, szkriptet kértél? Ezt a gamemode-ba kellene szerintem.

Játékosnév részlet lekérés
« Válasz #2 Dátum: 2013. február 05. - 20:32:27 »
0 Show voters
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;
}

 
Így lazán ennyi lenne. Köszi az eddigi segítséget!

Játékosnév részlet lekérés
« Válasz #3 Dátum: 2013. február 05. - 20:53:12 »
+1 Show voters
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
}

 

Dupla hozzászólás automatikusan összefûzve. ( 2013. február 05. - 20:53:52 )

Csak a vége felé irtam hozzá.

Játékosnév részlet lekérés
« Válasz #4 Dátum: 2013. február 05. - 20:57:43 »
0 Show voters
Köszönöm szépen! Respect!

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal