24.12.2011, 13:48
pawn Код:
CMD:v(playerid, params[])
{
if(IsInDm[playerid] == 1)
{
SendClientMessage(playerid, ERROR,"You cannot spawn vehicles until you are in a Deathmatch. Type /leavedm to leave deathmatch.");
}
else if(IsInDerby[playerid] == 1)
{
SendClientMessage(playerid, ERROR,"You cannot spawn vehicles until you are in a Derby. Type /leavederby to leave derby.");
}
else if(IsInRace[playerid] == 1)
{
SendClientMessage(playerid, ERROR,"You cannot spawn vehicles until you are in a Race. Type /leaverace to leave race.");
}
else if(IsInParkour[playerid] == 1)
{
SendClientMessage(playerid, ERROR,"You cannot spawn vehicles until you are in a Parkour. Type /leaveparkour to leave parkour.");
}
else if(IsInDrift[playerid] == 1)
{
SendClientMessage(playerid, ERROR,"You cannot spawn vehicles until you are in a Drift. Type /leavedrift to leave .");
}
else
{
if(!strlen(params)) return SendClientMessage(playerid, ERROR, "Usage: /veh [Name/Modelid]");
new iModel = 0;
if(!IsNumeric(params))
{
for(new i; i < sizeof(vNames); i++)
{
if(!strcmp(params, vNames[i]))
{
iModel = i;
break;
}
}
if(iModel == 0) return SendClientMessage(playerid, ERROR, "Invalid Vehicle.");
}
else iModel = strval(params);
if(iModel > 611 || iModel < 400) return SendClientMessage(playerid, ERROR, "Vehicle models are between 400 and 611.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PutPlayerInVehicle(playerid, CreateVehicle(iModel, x, y, z, 0.0, -1, -1, -1), 0);
}
return 1;
}