GameTextForPlayer when players is OnPlayerSpawnRequest
#1

Greetings,

I want to know how can I make a GameTextForPlayer when the players is OnPlayerRequestSpawn

For example I have this code
pawn Код:
//* Grove Street Spawn
    AddPlayerClass(105,2513.9976,-1691.0531,14.0460,49.8205,24,300,31,400,32,100);
    AddPlayerClass(106,2522.5876,-1679.2454,15.4970,78.9608,24,300,31,400,32,100);
    AddPlayerClass(107,2523.6533,-1658.8998,15.4935,110.5608,24,300,31,400,32,100);
    AddPlayerClass(105,2513.5066,-1650.2421,14.3557,133.1210,24,300,31,400,32,100);
    AddPlayerClass(106,2498.2974,-1642.2606,14.1131,172.9147,24,300,31,400,32,100);
    AddPlayerClass(107,2486.2468,-1644.8748,14.0772,188.8949,24,300,31,400,32,100);
    AddPlayerClass(105,2469.4922,-1646.3586,13.7801,181.3748,24,300,31,400,32,100);
    AddPlayerClass(106,2495.3301,-1690.2500,14.7656,0.0000,24,300,31,400,32,100);
    AddPlayerClass(107,2459.5049,-1691.0745,13.5446,359.1298,24,300,31,400,32,100);
And I don`t know how to add a game text there.

Regards,
Pablo.
Reply
#2

This may help.

https://sampwiki.blast.hk/wiki/GameTextForPlayer
Reply
#3

I already saw that, but I need a GameText for player when he is looking a skin
Reply
#4

the first addplayerclass is 0 and so go on as u add them under on gamemodeinit

request spawn is for when u click the spawn button
pawn Код:
public OnGameModeInit()
{
    //assuming these are the first set of add player class..... here u go
    AddPlayerClass(105,2513.9976,-1691.0531,14.0460,49.8205,24,300,31,400,32,100);//0
    AddPlayerClass(106,2522.5876,-1679.2454,15.4970,78.9608,24,300,31,400,32,100);//1
    AddPlayerClass(107,2523.6533,-1658.8998,15.4935,110.5608,24,300,31,400,32,100);//2
    AddPlayerClass(105,2513.5066,-1650.2421,14.3557,133.1210,24,300,31,400,32,100);//3
    AddPlayerClass(106,2498.2974,-1642.2606,14.1131,172.9147,24,300,31,400,32,100);//4
    AddPlayerClass(107,2486.2468,-1644.8748,14.0772,188.8949,24,300,31,400,32,100);//5
    AddPlayerClass(105,2469.4922,-1646.3586,13.7801,181.3748,24,300,31,400,32,100);//6
    AddPlayerClass(106,2495.3301,-1690.2500,14.7656,0.0000,24,300,31,400,32,100);//7
    AddPlayerClass(107,2459.5049,-1691.0745,13.5446,359.1298,24,300,31,400,32,100);//8
    return 1;
}
//call under this
public OnPlayerRequestClass(playerid, classid)
{
  if(classid >= 0 && classid <= 8)
  {
     GameTextForPlayer(playerid, "Grove Street", 1000, 5); //style 5 last for 3 secs no matter what time u set it
  }
  return 1;
}
here is how 2 use it
pawn Код:
/*
This is just an example on how 2 a variable with on player request...example u know how u save player data with y_ini or dini or mysql right... creating a variable like that and u can store the value and use in under onplayerrequestspawn
*/

new NoLogin[MAX_PLAYERS];
public OnPlayerRequestSpawn(playerid)
{
/*
Not recommended 2 use the login in thing its just an example how to use a variable to stop a player from spawning
the second one is more what u are looking @ atm
*/

        if(NoLogin[playerid] == 1)
        {
           SendClientMessage(playerid, -1, "You are unwanted in this community");
           return 0;
        }
        if(GetPlayerSkin(playerid) == 105 || GetPlayerSkin(playerid) == 106 || GetPlayerSkin(playerid) == 107)
        {
            GameTextForPlayer(playerid, "Grove Street", 1000, 5); //style 5 last for 3 secs no matter what time u set it
        }
    return 1;
}
Reply
#5

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 287 && !IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid,0xFF9D1CAA,"ERROR: This skin is only for players who have the permission.");
        return 0;
    }
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}
{
  if(classid >= 0 && classid <= 8)
  {
     GameTextForPlayer(playerid, "Grove Street", 1000, 5);
  }
  return 1;
}
Give me
Код:
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1053) : error 055: start of function body without function header
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1054) : error 010: invalid function or declaration
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1058) : error 010: invalid function or declaration
Reply
#6

This may give you an idea, on how it is

https://sampwiki.blast.hk/wiki/AdminSkins
Reply
#7

im not just sure about if you're try to get skinid 287 or classid. reply back if you are trying to check skinid 287 or classid

//here you go
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    if(classid == 287 && !IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid,0xFF9D1CAA,"ERROR: This skin is only for players who have the permission.");
        return 0;
    }
    if(classid >= 0 && classid <= 8)
    {
        GameTextForPlayer(playerid, "Grove Street", 1000, 5);
    }
    return 1;
}
Reply
#8

I just want to have a GameTextForPlayer when players is checking this:
pawn Код:
//* Grove Street Spawn
    AddPlayerClass(105,2513.9976,-1691.0531,14.0460,49.8205,24,300,31,400,32,100);//0
    AddPlayerClass(106,2522.5876,-1679.2454,15.4970,78.9608,24,300,31,400,32,100);//1
    AddPlayerClass(107,2523.6533,-1658.8998,15.4935,110.5608,24,300,31,400,32,100);//2
    AddPlayerClass(105,2513.5066,-1650.2421,14.3557,133.1210,24,300,31,400,32,100);//3
    AddPlayerClass(106,2498.2974,-1642.2606,14.1131,172.9147,24,300,31,400,32,100);//4
    AddPlayerClass(107,2486.2468,-1644.8748,14.0772,188.8949,24,300,31,400,32,100);//5
    AddPlayerClass(105,2469.4922,-1646.3586,13.7801,181.3748,24,300,31,400,32,100);//6
    AddPlayerClass(106,2495.3301,-1690.2500,14.7656,0.0000,24,300,31,400,32,100);//7
    AddPlayerClass(107,2459.5049,-1691.0745,13.5446,359.1298,24,300,31,400,32,100);//8
Reply
#9

try this. you know where to put this. so help your self

pawn Код:
if(classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4
classid == 5 || classid == 5 || classid == 6 || classid == 7 || classid == 8)
{
    GameTextForPlayer(playerid, "Grove Street", 1000, 5);
}
Reply
#10

Quote:
Originally Posted by pds2012
Посмотреть сообщение
try this. you know where to put this. so help your self

pawn Код:
if(classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4
classid == 5 || classid == 5 || classid == 6 || classid == 7 || classid == 8)
{
    GameTextForPlayer(playerid, "Grove Street", 1000, 5);
}
Код:
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1054) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1058) : error 010: invalid function or declaration
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1061) : error 010: invalid function or declaration
Puting that in
pawn Код:
public OnPlayerRequestClass(playerid, classid)
}
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

if(classid == 0 || classid == 1 || classid == 2 || classid == 3 || classid == 4
classid == 5 || classid == 5 || classid == 6 || classid == 7 || classid == 8)
{
    GameTextForPlayer(playerid, "Grove Street", 1000, 5);
}


Doing this:
Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
pawn Код:
switch(classid)
{
    case 0 .. 8:
    {
        GameTextForPlayer(playerid, "~g~Grove Street", 1000, 5);
    }
}
I get this:

Код:
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1062) : error 054: unmatched closing brace ("}")
C:\Documents and Settings\Administrador\Escritorio\Gang Wars\gamemodes\GangWars.pwn(1066) : error 010: invalid function or declaration
Puting that in
pawn Код:
public OnPlayerRequestClass(playerid, classid)
switch(classid)
{
    case 0 .. 8:
    {
        GameTextForPlayer(playerid, "~g~Grove Street", 1000, 5);
    }
}

}
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)