SA-MP Forums Archive
RespawnVehicle Doesnt work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: RespawnVehicle Doesnt work (/showthread.php?tid=469170)



RespawnVehicle Doesnt work - yaron0600 - 12.10.2013

Hey, Everytime that they're /deliverwep and go to the checkpoint, I want the same car ; DeliverVehicles, will dessaper.


And this isnt, I put once (i) and this is respawning all the vehicle on server, how can I fix it?

Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new szMessage[128];
    new vehicleid;
    if(PlayerInfo[playerid][pDeliverPlane] = 1 && IsPlayerInRangeOfPoint(playerid, 10,1968.79, -2492.85, 13.54))
    format(szMessage, sizeof(szMessage), "You have picked up the Illeagel Deliver for Crate and succed to transfer it to LS! ");
    SendClientMessageEx(playerid, COLOR_YELLOW, szMessage);
    DisablePlayerCheckpoint(playerid);
    PlayerInfo[playerid][pGunCrates] += 1;
    for(new i = 1; i <= MAX_VEHICLES; i++)
    {
    SetVehicleToRespawn(vehicleid);
    }



Re: RespawnVehicle Doesnt work - Patrick - 12.10.2013

Here you go
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new
        szMessage[ 128 ]
    ;
    if(PlayerInfo[ playerid ][ pDeliverPlane ] == 1 && IsPlayerInRangeOfPoint(playerid, 10,1968.79, -2492.85, 13.54))
    format( szMessage, sizeof( szMessage ), "You have picked up the Illeagel Deliver for Crate and succed to transfer it to LS! ");
    SendClientMessageEx( playerid, COLOR_YELLOW, szMessage );
    DisablePlayerCheckpoint( playerid );
    PlayerInfo[ playerid ][ pGunCrates ] ++; //instead of +=1;
    // removed the useless loop
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehicleToRespawn(vehicleid);
    return 1;
}



Re: RespawnVehicle Doesnt work - yaron0600 - 12.10.2013

Why did you remove the +=1?


Re: RespawnVehicle Doesnt work - Patrick - 12.10.2013

Quote:
Originally Posted by yaron0600
Посмотреть сообщение
Why did you remove the +=1?
++; it is like +1 but that's the right thing that you need to add in your code. (the correct way)


Re: RespawnVehicle Doesnt work - yaron0600 - 12.10.2013

When I compile it's says : Pawno stopped to work, maybe something worng in the code? Cause when I undo it compiled clean.


Re: RespawnVehicle Doesnt work - Patrick - 12.10.2013

Sorry, made a mistake there, forgot 2 brackets, try these code now

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new
        szMessage[ 128 ]
    ;
    if(PlayerInfo[ playerid ][ pDeliverPlane ] == 1 && IsPlayerInRangeOfPoint(playerid, 10,1968.79, -2492.85, 13.54))
    {
        format( szMessage, sizeof( szMessage ), "You have picked up the Illeagel Deliver for Crate and succed to transfer it to LS! ");
        SendClientMessageEx( playerid, COLOR_YELLOW, szMessage );
       
        DisablePlayerCheckpoint( playerid );
        PlayerInfo[ playerid ][ pGunCrates ] ++;
        new vehicleid = GetPlayerVehicleID( playerid );
        SetVehicleToRespawn( vehicleid );
    }
    return 1;
}



Re: RespawnVehicle Doesnt work - yaron0600 - 12.10.2013

Same...


Re: RespawnVehicle Doesnt work - yaron0600 - 12.10.2013

Any help?


Re: RespawnVehicle Doesnt work - iFiras - 12.10.2013

Hope it works for you
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new szMessage[128];
    if(IsPlayerInAnyVehicle(playerid))
    {
    new vehicleid = GetPlayerVehicle(playerid);
    }
    if(PlayerInfo[playerid][pDeliverPlane] = 1 && IsPlayerInRangeOfPoint(playerid, 10,1968.79, -2492.85, 13.54))
    format(szMessage, sizeof(szMessage), "You have picked up the Illeagel Deliver for Crate and succed to transfer it to LS! ");
    SendClientMessage(playerid, COLOR_YELLOW, szMessage);
    DisablePlayerCheckpoint(playerid);
    PlayerInfo[playerid][pGunCrates] += 1;
    SetVehicleToRespawn(vehicleid);
}



Re: RespawnVehicle Doesnt work - yaron0600 - 12.10.2013

Same...I need help!