/givecar
#1

Hey guys, so i'm recently using a Zgaming Script Edited by my own, but the issue is that i dont have any experience with making own commands and such, so i'd like to ask someone a method of how to make one, for example /givecar as i know you'd have to make a Command thats also Editing the .ini file of the player.

If you guys can help me out that would be awesome since i'm trying to do it for my own for ages now Heh,
Thanks.
Reply
#2

here is the cmd Gud luck
PHP код:
CMD:givecar(playeridparams[])
{
       if(
Player[playerid][pAdmin] >= 3)
    {
    new 
id;
    if(
sscanf(params"u"id))return SendClientMessage(playerid, -1"[Database]:: /givecar [playerid]");
    if(
IsPlayerConnected(id))
        {
              if(
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_KRED"Invalid Player");
            if(
IsPlayerInAnyVehicle(id)) SendClientMessage(playerid,0x00FF00AA,"player in a vehicle.");
            else
            {
               new 
Float:pX,Float:pY,Float:pZ,Float:pw;
              
GetPlayerPos(idpX,pY,pZ);
              
GetPlayerFacingAngle(idpw);
               
veh[playerid] = CreateVehicle(541pXpYpZpw000);
            
PutPlayerInVehicle(idveh[playerid], 0);
            
GameTextForPlayer(id,"~w~Bullet",3000,1);
            
format(pstring,sizeof(pstring),"Administrator %s Give Car to Player %s ",GetName(playerid),GetName(id));
            
SendMessageToAdmins(pstring);
            }return 
GameTextForPlayer(id,"~r~Admin Give you Car",3000,1);
        }else return  
SendClientMessage(playeridCOLOR_KRED"Player is not connected!");
    }else return 
SendClientMessage(playeridCOLOR_KRED"You need level 3 admin to use this cmd!");

Reply
#3

Thanks alot, but is there also a Command which makes you able to set the colors aswell? So for example, /givecat [Vehicle ID] [Color1] [Color2]
Reply
#4

PHP код:
CMD:vcolor(playeridparams[])
{
       if(
Player[playerid][pVip] >= 1)
 {
    new 
color1,color2;
    if(
sscanf(params"ii"color1color2)) return SendClientMessage(playeridCOLOR_RED"[Database]:: /vcolor [color1] [color2]");
    if(
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) return SendClientMessage(playerid,COLOR_KRED"You are not in a vehicle.");
    
ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
    
SendClientMessage(playerid,COLOR_GREEN,"You have changed your vehicle's color.");
 }
    return 
1;

Reply
#5

I'll check when im at home if it worked, if it will work ill +Rep you.
Reply
#6

Quote:
Originally Posted by MBilal
Посмотреть сообщение
If i help u +Rep
Why do you bother asking for reputation? Can't you see he has less than 50 points?
Reputation points from users with more than 50 posts count.
Reply
#7

Having these errors,

G:\UK-RP\gamemodes\UKRP.pwn(4788 ) : error 017: undefined symbol "Player"
G:\UK-RP\gamemodes\UKRP.pwn(4788 ) : warning 215: expression has no effect
G:\UK-RP\gamemodes\UKRP.pwn(4788 ) : error 001: expected token: ";", but found "]"
G:\UK-RP\gamemodes\UKRP.pwn(4788 ) : error 029: invalid expression, assumed zero
G:\UK-RP\gamemodes\UKRP.pwn(4788 ) : fatal error 107: too many error messages on one line
Reply
#8

Код:
CMD:givecar(playerid,params[]) 
{ 
    new carid; 
    new id; 
    new Float:X, Float:Y, Float:Z, Float:angle; 
    new string[160]; 
    if(gPlayerInfo[playerid][PLAYER_LEVEL] < 2) return SendClientMessage(playerid, COLOR_RED, "You are Not Allowed To Use This Command!"); 
    if(sscanf(params,"du",id, carid)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /givecar [playerid] [carid]"); 
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This Player is Not Connected!"); 
    if(carid < 400 || carid > 611) return  SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Vehicle Model!"); 
    GetPlayerPos(id, X, Y, Z); 
    GetPlayerFacingAngle(id, angle); 
    CreateVehicle(carid, X, Y, Z, angle, 0, 1, 60); 
    PutPlayerInVehicle(id, carid, 0); 
    format(string, sizeof(string), "[INFO]: Administrator %s Has Spawned a Vehicles id %d To %s.", GetName(playerid), carid, GetName(id)); 
    SendClientMessageToAll(COLOR_PURPLE, string); 
    return 1; 
}
Change this :
Код:
if(gPlayerInfo[playerid][PLAYER_LEVEL] < 2
with what level do you want ! If doesn.t woring , try with your Admin variable !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)