if (!strcmp("/Landstalker", cmdtext, true))
{
new Float:X,Float:Y,Float:Z,Float:ROT;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle (playerid,ROT);
SpawnAuto[playerid] = CreateVehicle(400,x,y,z,ROT, -1, -1, 60); SetVehiclePos(SpawnAuto[playerid], X, Y, Z);
PutPlayerInVehicle(playerid,SpawnAuto[playerid],0);
GameTextForPlayer(playerid,"~h~~w~Landstalker~n~~h~~w~ID:~h~~r~400",2500,1);
return 1;
}
|
Al utilizar muchas veces йste comando puede floodear los autos.. Como se puede solucionar
pawn Код:
|
if (!strcmp("/Landstalker", cmdtext, true))
{
if(CreoVehiculo[playerid] == 1)
{
DestroyVehicle(playerid);
CreoVehiculo[playerid] = 1;
new Float:X,Float:Y,Float:Z,Float:ROT;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle (playerid,ROT);
SpawnAuto[playerid] = CreateVehicle(400,X,Y,Z,ROT, -1, -1, 60); SetVehiclePos(SpawnAuto[playerid], X, Y, Z);
PutPlayerInVehicle(playerid,SpawnAuto[playerid],0);
return 1;
}
if(CreoVehiculo[playerid] == 0)
{
CreoVehiculo[playerid] = 1;
new Float:X,Float:Y,Float:Z,Float:ROT;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle (playerid,ROT);
SpawnAuto[playerid] = CreateVehicle(400,X,Y,Z,ROT, -1, -1, 60); SetVehiclePos(SpawnAuto[playerid], X, Y, Z);
PutPlayerInVehicle(playerid,SpawnAuto[playerid],0);
return 1;
}
}
#if !defined IsValidVehicle
native IsValidVehicle(vehicleid);
#endif
public OnPlayerConnect(playerid)
{
SpawnAuto[playerid] = INVALID_VEHICLE_ID;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(IsValidVehicle(SpawnAuto[playerid]))
{
DestroyVehicle(SpawnAuto[playerid]);
}
return 1;
}
if(!strcmp("/landstalker", cmdtext, true))
{
new Float:fX, Float:fY, Float:fZ, Float:fAngle;
GetPlayerPos(playerid, fX, fY, fZ);
GetPlayerFacingAngle(playerid, fAngle);
if(IsValidVehicle(SpawnAuto[playerid])) DestroyVehicle(SpawnAuto[playerid]);
SpawnAuto[playerid] = CreateVehicle(400, fX, fY, fZ, fAngle, random(258), random(258), -1);
LinkVehicleToInterior(SpawnAuto[playerid], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(SpawnAuto[playerid], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, SpawnAuto[playerid], 0);
GameTextForPlayer(playerid, "~h~~w~Landstalker~n~~h~~w~ID:~h~~r~400", 2500, 1);
}
|
No hace falta aсadir otra variable.
Код:
#if !defined IsValidVehicle
native IsValidVehicle(vehicleid);
#endif
public OnPlayerConnect(playerid)
{
SpawnAuto[playerid] = INVALID_VEHICLE_ID;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(IsValidVehicle(SpawnAuto[playerid]))
{
DestroyVehicle(SpawnAuto[playerid]);
}
return 1;
}
if(!strcmp("/landstalker", cmdtext, true))
{
new Float:fX, Float:fY, Float:fZ, Float:fAngle;
GetPlayerPos(playerid, fX, fY, fZ);
GetPlayerFacingAngle(playerid, fAngle);
if(IsValidVehicle(SpawnAuto[playerid])) DestroyVehicle(SpawnAuto[playerid]);
SpawnAuto[playerid] = CreateVehicle(400, fX, fY, fZ, fAngle, random(258), random(258), -1);
LinkVehicleToInterior(SpawnAuto[playerid], GetPlayerInterior(playerid));
SetVehicleVirtualWorld(SpawnAuto[playerid], GetPlayerVirtualWorld(playerid));
PutPlayerInVehicle(playerid, SpawnAuto[playerid], 0);
GameTextForPlayer(playerid, "~h~~w~Landstalker~n~~h~~w~ID:~h~~r~400", 2500, 1);
}
|