27.01.2013, 19:22
Hey folks,
Can you convert me this to ZCMD please, using SSCANF.
Can you convert me this to ZCMD please, using SSCANF.
pawn Код:
if(strcmp(cmd, "/vplate", true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /vplate [text]");
return 1;
}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
{
new ownvehkey;
new car = GetPlayerVehicleID(playerid);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
if(GetPlayerMoney(playerid) < 200)
{
SendClientMessage(playerid,COLOR_WHITE,"* You do not have $200, to change you're number plate with the DVLA!");
return 1;
}
strmid(CarInfo[car][cPlate], result, 0, strlen(result), 999);
new vid = GetPlayerVehicleID(playerid);
GivePlayerMoney(playerid,-5000);
SetVehicleNumberPlate(vid, CarInfo[vid][cPlate]);
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
OnPropUpdate(4,car);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Please sit in your car before selling! ");
return 1;
}
}