Originally Posted by Lokii
PHP Code:
forward CarSpawner(playerid,model);
public CarSpawner(playerid,model)
{
if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, 0x33AA33AA, "You already have a car!");
else
{
new Float:x, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
//if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]);
new vehicleid=CreateVehicle(model, x, y, z, angle, -1, -1, -1);
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, vehicleid, 0);
ChangeVehicleColor(vehicleid,0,7);
//PlayerInfo[playerid][pCar] = vehicleid;
}
return 1;
}
why not
PHP Code:
CarSpawner(playerid,model)
{
if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, 0x33AA33AA, "You already have a car!");
else
{
new Float:x, Float:y, Float:z, Float:angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);
//if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]);
new vehicleid=CreateVehicle(model, x, y, z, angle, -1, -1, -1);
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, vehicleid, 0);
ChangeVehicleColor(vehicleid,0,7);
//PlayerInfo[playerid][pCar] = vehicleid;
}
return 1;
}
AND
why use 3 callbacks 1 to get health 2 to set speedtextdraw and 3 get speed while this could be done in 1 callback
You could use 1 timer
Why include foreach and not use it?
Why dont you destroy player text draw when player leaves
|