11.07.2012, 20:54
Try this, just a car command.
pawn Code:
CMD:car(playerid,params[])
{
new string[128],idx;
string = strtok(params, idx);
if(!strlen(string))
{
SendClientMessage(playerid,COLOR_GREY, "SERVER: /car [ID] [C1] [C2]");
return 1;
}
new car = strval(string);
if(car < 400 || car > 611)
{
SendClientMessage(playerid, COLOR_GREY, " VehicleID: 400-611"); return 1;
}
string = strtok(params, idx);
if(!strlen(string))
{
SendClientMessage(playerid, COLOR_GREY, "SERVER: /car [ID] [C1] [C2]");
return 1;
}
new color1 = strval(string);
string = strtok(params, idx);
if(!strlen(string))
{
SendClientMessage(playerid, COLOR_GREY, "SERVER: /car [ID] [C1] [C2]");
return 1;
}
new color2 = strval(string);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new v = CreateVehicle(car, X+2,Y,Z, 0.0,color1,color2, -1);
LinkVehicleToInterior(v,GetPlayerInterior(playerid));
SetVehicleVirtualWorld(v,GetPlayerVirtualWorld(playerid));
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' ')) { index++; }
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{ result[index - offset] = string[index]; index++; }
result[index - offset] = EOS;
return result;
}