/givecar -
litmanen - 11.09.2014
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.
Re: /givecar -
MBilal - 11.09.2014
here is the cmd Gud luck
PHP код:
CMD:givecar(playerid, params[])
{
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(playerid, COLOR_KRED, "Invalid Player");
if(IsPlayerInAnyVehicle(id)) SendClientMessage(playerid,0x00FF00AA,"player in a vehicle.");
else
{
new Float:pX,Float:pY,Float:pZ,Float:pw;
GetPlayerPos(id, pX,pY,pZ);
GetPlayerFacingAngle(id, pw);
veh[playerid] = CreateVehicle(541, pX, pY, pZ, pw, 0, 0, 0);
PutPlayerInVehicle(id, veh[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(playerid, COLOR_KRED, "Player is not connected!");
}else return SendClientMessage(playerid, COLOR_KRED, "You need level 3 admin to use this cmd!");
}
Re: /givecar -
litmanen - 11.09.2014
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]
Re: /givecar -
MBilal - 11.09.2014
PHP код:
CMD:vcolor(playerid, params[])
{
if(Player[playerid][pVip] >= 1)
{
new color1,color2;
if(sscanf(params, "ii", color1, color2)) return SendClientMessage(playerid, COLOR_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;
}
Re: /givecar -
litmanen - 11.09.2014
I'll check when im at home if it worked, if it will work ill +Rep you.
Re: /givecar -
Stinged - 11.09.2014
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.
Re: /givecar -
litmanen - 11.09.2014
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
Re: /givecar -
Reputation - 11.09.2014
Код:
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 !