SA-MP Forums Archive
Teleport info for all players? - 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)
+--- Thread: Teleport info for all players? (/showthread.php?tid=307341)



Teleport info for all players? - Wayn - 30.12.2011

hi,how do you make a teleport visible to all if somone uses it? Like
[info]Wayn has teleported to /sf.
I know it uses %s etc but how will the code look like?
Thanks.


Re: Teleport info for all players? - Ironboy - 30.12.2011

Example
pawn Код:
CMD:sf(playerid,params[]) {
    SetPlayerPos(playerid,x,y,z); //change x, y, z coordinates
    new string[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s has just teleported to SF", name);
    SendClientMessageToAll(COLOR_YELLOW, string);
    return 1;}



Re: Teleport info for all players? - Wayn - 30.12.2011

thats all i needed,thanks man!


Re: Teleport info for all players? - Wayn - 31.12.2011

One more thing , please take a look at this code, when a player teleports to a certain place by FOOT, it says "[ ! ]{Name} teleported to LV [/lv] << works ... but when a player is in Vehicle, it says [ ! ] teleported to LV [/lv]" i mean the player's name wont show while in a vehicle, why?



PHP код:
if(strcmp("/lv",cmdtext,true) == 0)
{
    new 
vehicleid=GetPlayerVehicleID(playerid);
    new 
string[128];
    new 
name[MAX_PLAYER_NAME];
    if(
IsPlayerInAnyVehicle(playerid))
    {
        
SetPlayerPos(playerid,1907.1353,960.5406,10.8203);
        
SetVehiclePos(vehicleid,1907.1353,960.5406,10.8203);
        
format(stringsizeof(string), "[ ! ]%s has just teleported to LasVenturas [/lv]"name);
        
SendClientMessageToAll(COLOR_YELLOWstring);
        
PutPlayerInVehicle(playerid,vehicleid,0);
    }
    else
    {
    
SetPlayerPos(playerid,1907.1353,960.5406,10.8203);
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "[ ! ]%s has just teleported to LasVenturas [/lv]"name);
    
SendClientMessageToAll(COLOR_YELLOWstring);
    }
    return 
1;




Re: Teleport info for all players? - James Coral - 31.12.2011

pawn Код:
new name
GetPlayerName(playerid, name, sizeof(name));



Re: Teleport info for all players? - coole210 - 31.12.2011

oh wayn, could've just skyped me.

pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
Sets the string "name" to "playerid"'s name.


Re: Teleport info for all players? - Wayn - 31.12.2011

Oh shit! My bad! lol never noticed that,damn i feel noob lol! >.< Thanks! rep for both