SA-MP Forums Archive
Spawn name while spawning - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Spawn name while spawning (/showthread.php?tid=201889)



Spawn name while spawning - nuriel8833 - 22.12.2010

Hello
I made a script that says the name of the spawn location while you are spawning
Here are the Spawns:
pawn Код:
new PlayerSpawns[][5] {
{XXX,XXX,XXX,XXX,Los Santos},
{XXX,XXX,XXX,XXX,San Fierro},
{XXX,XXX,XXX,XXX,Las Venturas}
}
(Instead of the XXX there is a location,if there is XXX XXX its the name of the place,for example: Los Santos)

And I was putting this on OnPlayerSpawn:
pawn Код:
SendClientMessage(playerid,RED,"You have been spawned in %s",PlayerSpawns[randsp][5]);
But it doesn't work
Any ideas why?


Re: Spawn name while spawning - Krx17 - 22.12.2010

Mind showing us some more code, or the actual code?


Re: Spawn name while spawning - nuriel8833 - 22.12.2010

Quote:
Originally Posted by Krx17
Посмотреть сообщение
Mind showing us some more code, or the actual code?
This is the actuall code O.o


Re: Spawn name while spawning - nuriel8833 - 23.12.2010

Bump


Re: Spawn name while spawning - [JnA]DukeNukem - 23.12.2010

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
Bump
I don't get your signature, it's serbian and israel flag? gz im serbian


Re: Spawn name while spawning - nuriel8833 - 23.12.2010

Quote:
Originally Posted by [JnA]DukeNukem
Посмотреть сообщение
I don't get your signature, it's serbian and israel flag? gz im serbian
www.flagcounter.com


Re: Spawn name while spawning - Mean - 23.12.2010

IsPlayerInRangeOfPoint should do the work

like
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, los, santos, spawn, 15))
    {
        SendClientMessage(playerid, COLOR, "You spawned in Los Santos");
    }
    if(IsPlayerInRangeOfPoint(playerid, san, fierro, spawn, 15))
    {
        SendClientMessage(playerid, COLOR, "You spawned in San fierro");
    }
    // And so on...
    return 1;
}
Replace these los, santos, spawn with X, Y and Z of thoose spawns, and replace the COLOR.


Re: Spawn name while spawning - nuriel8833 - 23.12.2010

Quote:
Originally Posted by Mean
Посмотреть сообщение
IsPlayerInRangeOfPoint should do the work

like
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, los, santos, spawn, 15))
    {
        SendClientMessage(playerid, COLOR, "You spawned in Los Santos");
    }
    if(IsPlayerInRangeOfPoint(playerid, san, fierro, spawn, 15))
    {
        SendClientMessage(playerid, COLOR, "You spawned in San fierro");
    }
    // And so on...
    return 1;
}
Replace these los, santos, spawn with X, Y and Z of thoose spawns, and replace the COLOR.
And what is the 15?
And where can I change the angle?

Quote:
Originally Posted by Mikkel_Pedersen
Посмотреть сообщение
When you're saying it doesn't work, do you mean that it compiles with errors, or that it shows something else in the chat in the server? I got an idea why it could be showing some numbers instead of the actual name, but I want to hear what exactly isn't working before replying with a possible helpful reply.
Its just doesn't do anything when I am typing /ls /sf /lv etc..


Re: Spawn name while spawning - Mikkel_Pedersen - 23.12.2010

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
And what is the 15?
And where can I change the angle?



Its just doesn't do anything when I am typing /ls /sf /lv etc..
Well just noticed you did this:
pawn Код:
SendClientMessage(playerid,RED,"You have been spawned in %s",PlayerSpawns[randsp][5]);
Dunno if it would block the command, but: SendClientMessage can't format a message containing strings, you have to use "format" first, less you redefined SendClientMessage. Anyway it could be cause you didn't use format.

EDIT: Ryder showed how to do.


Re: Spawn name while spawning - Mean - 24.12.2010

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
And what is the 15?
And where can I change the angle?



Its just doesn't do anything when I am typing /ls /sf /lv etc..
My bad, it's :
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 15, los, santos, spawn))
    {
        SendClientMessage(playerid, COLOR, "You spawned in Los Santos");
    }
    if(IsPlayerInRangeOfPoint(playerid, 15, san, fierro, spawn))
    {
        SendClientMessage(playerid, COLOR, "You spawned in San fierro");
    }
    // And so on...
    return 1;
}
+ This is called ONLY when you spawn