SA-MP Forums Archive
Vehicle Spawn - 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: Vehicle Spawn (/showthread.php?tid=615289)



Vehicle Spawn - Rassh - 20.08.2016

Why does this error happen, can anyone fix it for me?
Quote:

public OnPlayerConnectText(playerid, cmdtext[]
{
if (!strcmp("/nrg", cmdtext, true))
{
new Float:X, Float:Y, Float:Z, Float:ROT;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, ROT);
SpawnedVehicles[playerid] = CreateVehicle(522,X,Y,Z,ROT,-1,-1,60);
PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0);
return 1;
}




Re: Vehicle Spawn - Shinja - 20.08.2016

What error? and tell us what happens


Re: Vehicle Spawn - oMa37 - 20.08.2016

PHP код:
public OnPlayerConnectText(playeridcmdtext[] 
From where you got this? O.o
Here is the right code:

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (!
strcmp("/nrg"cmdtexttrue))
    {
        new 
Float:XFloat:YFloat:ZFloat:ROT;
        
GetPlayerPos(playeridXYZ);
        
GetPlayerFacingAngle(playeridROT);
        
SpawnedVehicles[playerid] = CreateVehicle(522,X,Y,Z,ROT,-1,-1,60);
        
PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0);
        return 
1;
    }
    return 
0;




Re: Vehicle Spawn - Rassh - 20.08.2016

oMa i tried yours and this happens.
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(3 : error 017: undefined symbol "SpawnedVehicles"
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(3 : warning 215: expression has no effect
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(3 : error 001: expected token: ";", but found "]"
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(3 : error 029: invalid expression, assumed zero
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(3 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Re: Vehicle Spawn - Shinja - 20.08.2016

SpawnedVehicles is your variable not his, well if you don't such line add it
PHP код:
new SpawnedVehicles[MAX_PLAYERS]; 



Re: Vehicle Spawn - Rassh - 20.08.2016

Quote:
Originally Posted by Shinja
Посмотреть сообщение
SpawnedVehicles is your variable not his, well if you don't such line add it
PHP код:
new SpawnedVehicles[MAX_PLAYERS]; 
Can you fix the whole script for me and send it to me?


Re: Vehicle Spawn - Shinja - 20.08.2016

Quote:
Originally Posted by Shinja
Посмотреть сообщение
SpawnedVehicles is your variable not his, well if you don't such line add it
PHP код:
new SpawnedVehicles[MAX_PLAYERS]; 
Add this line under your includes


Re: Vehicle Spawn - Rassh - 20.08.2016

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Add this line under your includes
That's what i did and this shows up.
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(39 -- 40) : warning 215: expression has no effect
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(40) : error 001: expected token: ";", but found "-identifier-"
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(40) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: Vehicle Spawn - Shinja - 21.08.2016

Show lines


Re: Vehicle Spawn - Rassh - 21.08.2016

fixed it, thanks to everyone who responded