Vehicle Spawn
#1

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;
}

Reply
#2

What error? and tell us what happens
Reply
#3

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;

Reply
#4

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.
Reply
#5

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

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?
Reply
#7

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
Reply
#8

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.
Reply
#9

Show lines
Reply
#10

fixed it, thanks to everyone who responded
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)