Need help with player name
#3

Here's the command using ZCMD and sscanf! You require them in your script to use this command!

pawn Код:
COMMAND:eject(playerid, params[])
{
    if (IsPlayerConnected(playerid))
    {
        new player,string[80];
        if(sscanf(params,"u",player)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /eject [playerid/partofname]]");
        if(!IsPlayerConnected(player)) return SendClientMessage(playerid, COLOR_GREY, "Invalid Player. That Player is not connected to the server.");
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to be in a vehicle to use this command.");
        if(!IsPlayerInAnyVehicle(player)) return SendClientMessage(playerid, COLOR_GREY, "That player is not in any vehicle.");
        new vid = GetPlayerVehicleID(playerid),pid = GetPlayerVehicleID(player),pname[MAX_PLAYERS],plname[MAX_PLAYERS];
        if(vid != pid) return SendClientMessage(playerid, COLOR_GREY, "That player needs to be in your vehicle to eject them.");
        GetPlayerName(playerid, pname, sizeof(pname)),GetPlayerName(player, plname, sizeof(plname));
        format(string, sizeof(string), "* You have been ejected by %s from their vehicle.", pname);
        SendClientMessage(player,COLOR_YELLOW,string);
        format(string, sizeof(string), "* You have ejected %s from your vehicle.", plname);
        SendClientMessage(playerid,COLOR_YELLOW,string);
    }
    return 1;
}
Reply


Messages In This Thread
Need help with player name - by SlonCHL - 28.11.2012, 10:04
Re: Need help with player name - by IceBilizard - 28.11.2012, 10:22
Re: Need help with player name - by Ballu Miaa - 28.11.2012, 10:25
Re: Need help with player name - by SlonCHL - 28.11.2012, 10:50
Re: Need help with player name - by SlonCHL - 28.11.2012, 11:11
Re: Need help with player name - by Ballu Miaa - 28.11.2012, 11:14
Re: Need help with player name - by SlonCHL - 28.11.2012, 11:20
Re: Need help with player name - by Ballu Miaa - 28.11.2012, 11:22
Re: Need help with player name - by SlonCHL - 28.11.2012, 11:35
Re: Need help with player name - by SlonCHL - 28.11.2012, 11:43

Forum Jump:


Users browsing this thread: 2 Guest(s)