27.05.2012, 06:38
Thx,i've got it,but i have another problem:
I have a command which creates objects:
If i use /ramp up or /ramp down and relog,the object remains there and is not being destroyed,i've tried:
But is not working,if i rejoin the object is still there
I have a command which creates objects:
pawn Код:
if(strcmp(cmd, "/ramp", true) == 0)
{
if(IsPlayerConnected(playerid))
{
SetPlayerColor(playerid,COLOR_WHITE);
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_WHITE, "UTILIZEAZA: /ramp (down sau up)");
return 1;
}
{
new rampup = GetPVarInt(playerid, "RampUp");
new rampdn = GetPVarInt(playerid, "RampDown");
new carid = GetPlayerVehicleID(playerid);
//new mm = GetVehicleModel(carid);
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsADFT(carid))
{
if(strcmp(x_nr,"up",true) == 0)
{
if(IsValidObject(rampdn))
{
DestroyObject(rampdn);
SetPVarInt(playerid, "RampDown", 0);
}
if(!IsValidObject(rampup))
{
rampup = CreateObject(18756,0,0,-1000,0,0,0,100);
SetPVarInt(playerid, "RampUp", rampup);
}
AttachObjectToVehicle(rampup, carid, 0.524999,-2.700001,1.650000,-269.999877,0.000000,89.099983);
format(string, sizeof(string), "* %s a ridicat rampa.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else if(strcmp(x_nr,"down",true) == 0)
{
if(IsValidObject(rampup))
{
DestroyObject(rampup);
SetPVarInt(playerid, "RampUp", 0);
}
if(!IsValidObject(rampdn))
{
rampdn = CreateObject(18756,0,0,-1000,0,0,0,100);
SetPVarInt(playerid, "RampDown", rampdn);
}
AttachObjectToVehicle(rampdn, carid, 0.450000,-8.324991,0.075000,-35.100002,269.999877,178.199890);
format(string, sizeof(string), "* %s a lasat rampa.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
}
}
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new vehicleid = GetPlayerVehicleID(playerid);
new rampup = GetPVarInt(playerid, "RampUp");
new rampdn = GetPVarInt(playerid, "RampDown");
if(IsADFT(vehicleid))
{
DestroyObject(rampup);
DestroyObject(rampdn);
}