15.07.2014, 21:00
Vocк deve usar sscanf ou params.
Sу sei usar sscanf com zcmd, o params, jб nгo sei.
Com params deve ser assim:
Sscanf:
Sу sei usar sscanf com zcmd, o params, jб nгo sei.
Com params deve ser assim:
pawn Код:
CMD:v(playerid, params[])
{
new String[200];
new Float:x, Float:y, Float:z;
if(!strlen(params[0])) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(params[0]);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
pawn Код:
CMD:v(playerid, params[])
{
new String[200], nomecarro[50];
new Float:x, Float:y, Float:z;
if(sscanf(params,"s",nomecarro)) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(nomecarro);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}