Attach Object To Player
#1

Why Is This Not Working


line 99: public OnPlayerCommandText(playerid, cmdtext[])
line 100: {
line 101: if (strcmp(cmdtext, "/chicken", true) == 0)
line 102: {
line 103: new float:X,float:Y,float:Z;
line 104: new chicken;
line 105: GetPlayerPos(playerid,float:X,float:Y,float:Z);
line 106: CreateObject(16776,float:X,float:Y,float:Z,0,0,0 );
line 107: AttachObjectToPlayer(chicken, playerid, 0, 0, 0, 0, 0, 0);
line 108: return 1;
line 109: }
line 110: return 0;
line 111: }


Warnings:

C:\Users\CTAMOD623\Desktop\Testing Script.pwn(105) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(105) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(105) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(106) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(106) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(106) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(10 : warning 217: loose indentation
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(110) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Warnings.

Reply
#2

Float values are declared with tag Float

And once declared, you don't need to always put the tag in front of them.
Reply
#3

sorry ime kinda new to pawn little help on what that means?
Reply
#4

That mean this:
pawn Код:
new float:X,float:Y,float:Z;
...
GetPlayerPos(playerid,float:X,float:Y,float:Z);
CreateObject(16776,float:X,float:Y,float:Z,0,0,0 );
should be like this:
pawn Код:
new Float:X, Float:Y, Float:Z;
...
GetPlayerPos(playerid, X, Y, Z);
CreateObject(16776, X, Y, Z, 0, 0, 0);
Reply
#5

Код:
line 106:  CreateObject(16776,float:X,float:Y,float:Z,0,0,0 );
line 107:  AttachObjectToPlayer(monkey, playerid, 0, 0, 0, 0, 0, 0);
where the heck did "monkey" come from?

and your using floats wrong;

and if your doing /chicken, i have no idea why you would use monkey as the var;

this is how it needs to be done:

Код:
//top:
new chicken[MAX_PLAYERS];

//edit for command:
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
line 106:  chicken[playerid] = CreateObject(16776,X,Y,Z,0,0,0 );
line 107:  AttachObjectToPlayer(chicken[playerid], playerid, 0, 0, 0, 0, 0, 0);
you need to read the wiki, it explains everything.
Reply
#6

woops lol i had it originaly planned out as a monkey its changed noq
Reply
#7

Can Someone Give Me The Whole Code Ime Still Having Errors

Code Now:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/chicken", true) == 0)
	{
  new float:X,float:Y,float:Z;
  new monkey;
  GetPlayerPos(playerid,X,Y,Z);
  monkey = CreateObject(16776,X,Y,Z,0.00,0.00,0.00);
  AttachObjectToPlayer( monkey, playerid, 0, 0, 0, 0, 0, 0);
 return 1;
 }
	return 0;
}
Warnings:
Код:
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(105) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(105) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(105) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(106) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(106) : warning 213: tag mismatch
C:\Users\CTAMOD623\Desktop\Testing Script.pwn(106) : warning 213: tag mismatch
Reply
#8

As said twice, it is "Float" not "float". And these are not errors but warnings.
Reply
#9

YES... warnings can make a function in the script not work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)