14.08.2012, 19:17
this is my command
and the problem is nothing happend after i changes the plate what to do?
pawn Код:
CMD:shopplate(playerid, params[])
{
if(PlayerInfo[playerid][pShopTech])
{
new iVehType, iVehIndex, iTargetOwner, carid, orderid, plate[32];
if(sscanf(params, "dds[32]", carid, orderid, plate))
{
SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopplate [carid] [orderid] [plate/remove]");
SendClientMessageEx(playerid, COLOR_GREY, "COLORS: (black/white/blue/red/green/purple/yellow/lightblue/navy/beige/darkgreen/darkblue/darkgrey/gold/brown/darkbrown/darkred");
SendClientMessageEx(playerid, COLOR_GREY, "/maroon/pink) USAGE: (red)Hi(white)how are you? NOTE: Each color counts for 8 characters");
return 1;
}
foreach(new i: Player)
{
iVehIndex = GetPlayerVehicle(i, carid);
if(iVehIndex != -1)
{
iVehType = 1;
iTargetOwner = i;
break;
}
}
if(iVehType == 1)
{
format(plate, sizeof(plate), "%s", str_replace("(black)", "{000000}", plate));
format(plate, sizeof(plate), "%s", str_replace("(white)", "{FFFFFF}", plate));
format(plate, sizeof(plate), "%s", str_replace("(blue)", "{0000FF}", plate));
format(plate, sizeof(plate), "%s", str_replace("(red)", "{FF0000}", plate));
format(plate, sizeof(plate), "%s", str_replace("(green)", "{008000}", plate));
format(plate, sizeof(plate), "%s", str_replace("(purple)", "{800080}", plate));
format(plate, sizeof(plate), "%s", str_replace("(yellow)", "{FFFF00}", plate));
format(plate, sizeof(plate), "%s", str_replace("(lightblue)", "{ADD8E6}", plate));
format(plate, sizeof(plate), "%s", str_replace("(navy)", "{000080}", plate));
format(plate, sizeof(plate), "%s", str_replace("(beige)", "{F5F5DC}", plate));
format(plate, sizeof(plate), "%s", str_replace("(darkgreen)", "{006400}", plate));
format(plate, sizeof(plate), "%s", str_replace("(darkblue)", "{00008B}", plate));
format(plate, sizeof(plate), "%s", str_replace("(darkgrey)", "{A9A9A9}", plate));
format(plate, sizeof(plate), "%s", str_replace("(gold)", "{FFD700}", plate));
format(plate, sizeof(plate), "%s", str_replace("(brown)", "{A52A2A}", plate));
format(plate, sizeof(plate), "%s", str_replace("(darkbrown)", "{5C4033}", plate));
format(plate, sizeof(plate), "%s", str_replace("(darkred)", "{8B0000}", plate));
new string[128], Float:X, Float:Y, Float:Z;
GetVehiclePos(carid, X, Y, Z);
if(strcmp(plate, "remove", true) == 0)
{
PlayerVehicleInfo[iTargetOwner][iVehIndex][pvPlate] = 0;
}
else
{
format(PlayerVehicleInfo[iTargetOwner][iVehIndex][pvPlate], 32, "%s", plate);
SetVehicleToRespawn(carid);
SetVehiclePos(carid, X, Y, Z);
}
format(string, sizeof(string), "Plate set on %s (ID: %d) %s (ID: %d)", GetPlayerNameEx(iTargetOwner), iTargetOwner, GetVehicleName(carid), carid);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "(OrderID: %d) Plate: %s", orderid, plate);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s set %s %s (Slot %d) plate to %s (order %d)", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetOwner), GetVehicleName(carid), iVehIndex, plate, orderid);
Log("logs/shoplog.log", string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "This is not a player owned vehicle, you cannot give it a custom plate.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
}
return 1;
}