OnPlayerSpawn issue.
#1

Well, I'm starting my first roleplay gamemode and for some reason when I'm setting the PlayerSpawnPoint it just gives me 16 warnings... Lol. I know they don't effect the script - but I just don't like the idea of having 16 warnings...

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 00,2136.7041,33.7916,26.4215,265.5875,0,0,0,0,0,0);
    GivePlayerMoney(playerid, 1000);
    SendClientMessage(playerid, COLOR_YELLOW, "You have been given $1000 to start off with. Spend it wisely!");
    return 1;
}
Here are my warnings.

pawn Код:
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(329) : warning 202: number of arguments does not match definition
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(329) : warning 202: number of arguments does not match definition
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(329) : warning 202: number of arguments does not match definition
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(329) : warning 202: number of arguments does not match definition
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(329) : warning 202: number of arguments does not match definition
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(329) : warning 202: number of arguments does not match definition
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(329) : warning 202: number of arguments does not match definition
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(329) : warning 202: number of arguments does not match definition
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(931) : warning 215: expression has no effect
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(1153) : warning 215: expression has no effect
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(1155) : warning 215: expression has no effect
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(1195) : warning 217: loose indentation
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(1200) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


13 Warnings.
Yeah... Just managed to get it down to 13!
Reply
#2

Код:
SetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
Reply
#3

Quote:
Originally Posted by Sawalha
Посмотреть сообщение
Код:
SetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
pawn Код:
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(332) : error 029: invalid expression, assumed zero
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(332) : warning 221: label name "Float" shadows tag name
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(332) : error 029: invalid expression, assumed zero
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(332) : warning 221: label name "Float" shadows tag name
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(332) : error 029: invalid expression, assumed zero
C:\Users\Max Kleinman\Desktop\First RP gamemode\gamemodes\rp.pwn(332) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

I think you're trying to use something like SetSpawnInfo, and not SetPlayerPos. See,
https://sampwiki.blast.hk/wiki/SetSpawnInfo
Reply
#5

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I think you're trying to use something like SetSpawnInfo, and not SetPlayerPos. See,
https://sampwiki.blast.hk/wiki/SetSpawnInfo
Nope, I just want to spawn in the place where I put the cords in the first post without having any warnings.
Reply
#6

pawn Код:
SetPlayerPos(playerid, 00,2136.7041,33.7916,26.4215,265.5875,0,0,0,0,0,0);
This is wrong. SetPlayerPos uses '4' parameters, you are using 12...

You are confusing SetPlayerPos with SetSpawnInfo.
SetPlayerPos expects these parameters:
Код:
SetPlayerPos(playerid, Float:x, Float:y, Float:z)
SetSpawnInfo expects these parameters:
Код:
SetSpawnInfo(playerid, team, skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
If we deconstruct this line, we can determine what values we want...
Your first parameter would be the 'playerid' parameter, so that is fine how it is.

The next parameter was '00', which I am going to assume was a typo of '0, 0'.
These parameters will represent 'team' and 'skin'.

Then you have your x, y, z and angle parameters, and so on...
Код:
playerid = playerid
team = 0
skin = 0
Float:x = 2136.7041
Float:y = 33.7916
Float:z = 26.4215
Float:Angle = 265.5875
weapon1 = 0
weapon1_ammo = 0
weapon2 = 0
weapon2_ammo = 0
weapon3 = 0
weapon3_ammo = 0
Thus the correct code being:
pawn Код:
SetSpawnInfo(playerid, 0, 0, 2136.7041, 33.7916, 26.4215, 265.5875, 0, 0, 0, 0, 0, 0);
Replace 'SetPlayerPos' with that line.

EDIT:
Also, SetSpawnInfo should be under OnPlayerConnect, not OnPlayerSpawn.

pawn Код:
public OnPlayerConnect(playerid)
{
    SetSpawnInfo(playerid, 0, 0, 2136.7041, 33.7916, 26.4215, 265.5875, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    GivePlayerMoney(playerid, 1000);
    SendClientMessage(playerid, COLOR_YELLOW, "You have been given $1000 to start off with. Spend it wisely!");
    return 1;
}
Reply
#7

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 2136.7041,33.7916,26.4215);
    GivePlayerMoney(playerid, 1000);
    SendClientMessage(playerid, COLOR_YELLOW, "You have been given $1000 to start off with. Spend it wisely!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)