View Single Post
Old 06/02/2013, 06:13 AM   #5
antonio112
Gangsta
 
antonio112's Avatar
 
Join Date: Aug 2009
Location: Romania
Posts: 970
Reputation: 87
Default Re: Script Request Thread #6

Quote:
Originally Posted by Vytixz View Post
I want a command that when I type /car, an Infernus will be spawned and I will be put inside it right away.

Optional: A message in the chat saying "You have successfully spawned an infernus."

Thank you.
Here's your command in ZCMD:
pawn Code:
//Somewhere on top of your script, under #includes
new CarSpawned[MAX_PLAYERS];

CMD:car(playerid, params[])
{
    #pragma unused params
    if(CarSpawned[playerid] > 0)
        DestroyVehicle(CarSpawned[playerid]);

    new Float: Pos[4];
    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    GetPlayerFacingAngle(playerid, Pos[3]);
    CarSpawned[playerid] = CreateVehicle(411, Pos[0], Pos[1], Pos[2], Pos[3], 1, 1, 0);
    PutPlayerInVehicle(playerid, CarSpawned[playerid], 0);
    SendClientMessage(playerid, -1, "You have successfully spawned an Infernus.");
    return 1;
}



Quote:
Originally Posted by DerickClark View Post
i need a /setping. /setping (How Much Max)
Not sure if I understood your request. If I'm not wrong, you want a ping limit and if a player reaches that ping, he'll get kicked ... Well, here it is:
pawn Code:
//Somewhere on top of your script, under #includes
new MaxPing = 500;

CMD:setping(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
        return SendClientMessage(playerid, -1, "You're not allowed to use this command.");

    new ping, str[65], name[MAX_PLAYER_NAME];
    if(sscanf(params, "i", ping))
        return SendClientMessage(playerid, -1, "USAGE: /setping [MAX PING]");

    if(ping < 20 || ping > 1000)
         return SendClientMessage(playerid, -1, "Use real values, between 20 and 1000");

     GetPlayerName(playerid, name, sizeof name);
     MaxPing = ping;
     format(str, sizeof str, "Admin %s set the max ping to %i.", name, MaxPing);
     SendClientMessageToAll(-1, str);
     return 1;
}

//And now, under OnPlayerUpdate callback;

public OnPlayerUpdate(playerid)
{
    if(GetPlayerPing(playerid) > MaxPing) Kick(playerid);
    return 1;
}

If this is not what you asked for, please let me know ...
__________________
antonio112 is offline