[READ][BUGGED]Convert To ZCMD[NOT FIXED] -
Infinity90 - 08.06.2012
Can someone convert this to ZCMD ausing SSCAF, i failed at doing it.
pawn Код:
new cmd[200], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/v", true, 4) == 0)
{
new String[200];
new tmp[256];
new Float:x, Float:y, Float:z;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,red, "HINT /v [car name]");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid,red, "That vehicle name you have given was not found, please try again!");
if(Veh[playerid][VehId] == -1)
{
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);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
else
{
DestroyVehicle(Veh[playerid][VehId]);
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);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid,green, String);
return 1;
}
return 0;
}
Re: Convert -
Kindred - 08.06.2012
pawn Код:
CMD:v(playerid, params[])
{
new String[200], carname[128];
new Float:x, Float:y, Float:z;
if(sscanf(params, "s[128]", carname)) return SendClientMessage(playerid,red, "HINT /v [car name]");
new vehicle = GetVehicleModelIDFromName(carname);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid,red, "That vehicle name you have given was not found, please try again!");
if(Veh[playerid][VehId] == -1)
{
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);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
else
{
DestroyVehicle(Veh[playerid][VehId]);
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);
Veh[playerid][VehId] = PlayersVehicle;
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
}
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid,green, String);
return 1;
}
Not sure if it works, but, you can try it out. Haven't scripted in a while, and I forgot some shit.
Re: Convert -
Infinity90 - 08.06.2012
It's done that same thing what i do lol
When i use /v sultan or /v 425 or any vehicle ID or name it just says
HINT /v [car name]
Anyone know how to fix this?
Re: Convert -
Kindred - 08.06.2012
I don't see any problem with the code I posted. Plus, the sscanf part looks completely fine the way I made it. Are you sure you did it like this?
Re: Convert -
Infinity90 - 08.06.2012
I Copy'd and pasted it over my Command, it done the same thing as it done when i made it origianlly, it works with Onplayercommandtext :@
I think SSCANF is bugging it or something :#
Re: Convert -
Infinity90 - 08.06.2012
Sorry for double post but I fixed it lol I didn't have the SSCANF.DLL plugin xD sorry
Re: Convert -
MadeMan - 08.06.2012
You created a topic already
https://sampforum.blast.hk/showthread.php?tid=349302