parkcar
Код:
if(strcmp(cmd, "/parkcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 5)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new car = GetPlayerVehicleID(playerid) - 1;
new Float:x,Float:y,Float:z;
new Float:a;
GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
DynamicCars[car][CarX] = x;
DynamicCars[car][CarY] = y;
DynamicCars[car][CarZ] = z;
DynamicCars[car][CarAngle] = a;
DestroyVehicle(vehicleid);
CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1);
PutPlayerInVehicle(playerid,vehicleid,0);
SaveDynamicCars();
new wstring[128];
format(wstring, sizeof(wstring), "Estacionaste o veiculo %d.", vehicleid);
SendClientMessage(playerid,COLOR_ADMINCMD, wstring);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nao estas num veiculo");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nao es admin.");
}
}
return 1;
setcarcolor
Код:
if(strcmp(cmd, "/setcarcolor", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setcarcolor [colorid] [colorid]");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 5)
{
if(IsPlayerInAnyVehicle(playerid))
{
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "0-126 = Cores validas."); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "/setcarcolor [colorid] [colorid]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "0-126 = cores validas."); return 1; }
new car = GetPlayerVehicleID(playerid) - 1;
new vehicleid = GetPlayerVehicleID(playerid);
DynamicCars[car][CarColor1] = color1;
DynamicCars[car][CarColor2] = color2;
new wstring[128];
format(wstring, sizeof(wstring), "Mudaste a cor do veiculo %d's para %d-%d.", vehicleid,color1,color2);
SendClientMessage(playerid,COLOR_ADMINCMD, wstring);
new Float:cx,Float:cy,Float:cz;
GetVehiclePos(vehicleid,cx,cy,cz);
new Float:angle;
GetVehicleZAngle(vehicleid, angle);
DestroyVehicle(vehicleid);
CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1);
PutPlayerInVehicle(playerid,vehicleid,0);
SetVehiclePos(vehicleid, cx, cy, cz);
SetVehicleZAngle(vehicleid, angle);
SaveDynamicCars();
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nao estas num veiculo!");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Nao es admin.");
}
}
return 1;
}