Teleport info for all players?
#1

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.
Reply
#2

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;}
Reply
#3

thats all i needed,thanks man!
Reply
#4

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;

Reply
#5

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

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.
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)