Car spawn at the wrong place?
#1

Hello,

I guess some people saw my carspawn topic before. Now I updated it and there is a weird error in it. I show you.
pawn Код:
case 5:
            {
              if(GetPlayerMoney(playerid) < 40000)
        return SendClientMessage(playerid,COLOR_RED,"--> You don't have $40000!")  && SetPlayerPos(playerid,-1979.8074,270.1521,35.1719) && TogglePlayerControllable(playerid,1);
        GivePlayerMoney(playerid,-40000);
        SetPlayerPos(playerid,-1979.8074,270.1521,35.1719);
        GetPlayerPos(playerid,x,y,z);
        PlayerPlaySound(playerid,1058,0,0,0);
        TogglePlayerControllable(playerid,1);
        CreateVehicle(402,x+2,y+2,z+2,0,0,0,0);
        return SendClientMessage(playerid, COLOR_YELLOW, "--> You bought a Buffalo!");
            }
The coцrdinates at SetPlayerPos are outside Wang Cars. I set GetPlayerPos so it gets the coordinates where the player is outside. Then the sound and freeze comes. Now the point: The car should spawn near GetPlayerPos. But it doesnt it spawns at my old coцrdinates! DOes someone know this bug? And how to fix it?

Regards, Jochem

BTW: I know I could use the same coцrds as SetPlayerPos. I dont want it; it needs to be simply to modify!
Reply
#2

Try to use it UNDER PogglePlayerControllable.
Maybe it helps.
Reply
#3

Nope Doesnt help
Reply
#4

pawn Код:
if(GetPlayerMoney(playerid) < 40000) return SendClientMessage(playerid,COLOR_RED,"--> You don't have $40000!")  && SetPlayerPos(playerid,-1979.8074,270.1521,35.1719) && TogglePlayerControllable(playerid,1);
new car;
GivePlayerMoney(playerid,-40000);
car=CreateVehicle(402,-1979.8074,270.1521,35.1719,0,0,0,0);
PutPlayerInVehicle(playerid, car, 0);
PlayerPlaySound(playerid,1058,0,0,0);
TogglePlayerControllable(playerid,1);
return SendClientMessage(playerid, COLOR_YELLOW, "--> You bought a Buffalo!");
Tested and works.
Reply
#5

there should be an else after an if maybe that's why it's not spawning in the new coordinates
Reply
#6

Quote:
Originally Posted by DJDhan
there should be an else after an if maybe that's why it's not spawning in the new coordinates
WHAT!?
Reply
#7

Quote:
Originally Posted by Jeffry
Try to use it UNDER PogglePlayerControllable.
Maybe it helps.
poggle lol


or you could simply use the teleport coords in variable form


Код:
x=-1979.8074,y=270.1521,z=35.1719;

SetPlayerPos(playerid, x,y,z);
PlayerPlaySound(playerid,1058,0,0,0);
TogglePlayerControllable(playerid,1);
CreateVehicle(402,x+2,y+2,z+2,0,0,0,0);
return SendClientMessage(playerid, COLOR_YELLOW, "--> You bought a Buffalo!");
Reply
#8

Quote:
Originally Posted by FUNExtreme
Quote:
Originally Posted by DJDhan
there should be an else after an if maybe that's why it's not spawning in the new coordinates
WHAT!?
Well i didn't undertand why there was an "if player doesn't have $40000" to buy a car... but after that no "else if he has $40000" then give him the car an stuff. I just saw && and && after that ?
Reply
#9

Before SetPlayerPos: new Float,Float:y,Float:z;

like
pawn Код:
case 5:
            {
              if(GetPlayerMoney(playerid) < 40000)
        return SendClientMessage(playerid,COLOR_RED,"--> You don't have $40000!")  && SetPlayerPos(playerid,-1979.8074,270.1521,35.1719) && TogglePlayerControllable(playerid,1);
        GivePlayerMoney(playerid,-40000);
        SetPlayerPos(playerid,-1979.8074,270.1521,35.1719);
        new Float:x,Float:y,Float:z; //That line. Else x,y,z are seen as values of zero (0)
        GetPlayerPos(playerid,x,y,z);
        PlayerPlaySound(playerid,1058,0,0,0);
        TogglePlayerControllable(playerid,1);
        CreateVehicle(402,x+2,y+2,z+2,0,0,0,0);
        return SendClientMessage(playerid, COLOR_YELLOW, "--> You bought a Buffalo!");
            }
Reply
#10

Well, I don't really understand you, because when you see the script, I think everything is the right order ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)