Random Pos errors.
#1

I use it Like this:
PHP код:
new Float:SDM1[][] =
{
    {
2321.2295,1091.7527,79.5547,200.2727}, // SDM1 1st Spawn Pos
    
{2225.3442,1113.3691,64.9291,85.5682}, // SDM1 2nd Spawn Pos
    
{2279.4407,1112.3759,57.6250,105.3083}, // SDM1 3st Spawn Pos
    
{2196.1343,1004.8544,79.5547,175.1823}, //  SDM1 4th Spawn Pos
    
{2275.6519,1111.6068,71.2844,312.7136}, // SDM1 5th Spawn Pos
    
{2228.8796,1109.1208,64.8463,216.2060// SDM1 6th Spawn Pos
}; 
PHP код:
if (strcmp("/sdm"cmdtexttrue10) == 0)
    {
    new 
Random random(sizeof(SDM1));
    
SetPlayerPos(playeridSDM1[Random][0], SDM1[Random][1], SDM1[Random][2]);
        
SetPlayerFacingAngle(playeridSDM1[Random][3]);
    
SetPlayerHealth(playerid100);
    
SetPlayerArmour(playerid100);
    
SetPlayerSkin(playerid,137);
       
GivePlayerWeapon(playerid3499999);
       
GivePlayerWeapon(playerid461);
    }
        return 
1
But i show me errors
PHP код:
E:\GTA\gamemodes\mg.pwn(111) : error 017undefined symbol "SDM1"
E:\GTA\gamemodes\mg.pwn(111) : error 029invalid expressionassumed zero
E
:\GTA\gamemodes\mg.pwn(111) : warning 215expression has no effect
E
:\GTA\gamemodes\mg.pwn(112) : error 017undefined symbol "SDM1"
E:\GTA\gamemodes\mg.pwn(112) : warning 215expression has no effect
E
:\GTA\gamemodes\mg.pwn(112) : error 001expected token";"but found "]"
E:\GTA\gamemodes\mg.pwn(112) : error 029invalid expressionassumed zero
E
:\GTA\gamemodes\mg.pwn(112) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
6 Errors

Reply
#2

Reply
#3

Fixed.
anther problem: in OnPlayerRequstClass
PHP код:
public OnGameModeInit()
{
    
    
SetGameModeText("Mini Games Script");
    
AddPlayerClass(2  ,        1628.6528,-2290.0068,94.1270,215.9542,       24,9999269999,289999); //Case 0 .
    
AddPlayerClass(264,        1210.7349,-2036.7631,69.0078,270.1496,       24,9999269999,289999);//Case 1 .
    
AddPlayerClass(102,        2111.3210,1258.4351,10.8203,107.3569,        24,9999269999,289999);//Case 2
    
AddPlayerClass(102,        2112.4336,1152.0609,13.5166,61.5863,         24,9999269999,289999);//Case 3
    
AddPlayerClass(115,        -1383.6305,680.5055,84.0078,188.0059,        24,9999269999,289999);//Case 4
    
AddPlayerClass(268,        -1544.6187,699.6717,148.2734,247.4590,       24,9999269999,289999);//Case 5
    
AddPlayerClass(138,        -1544.6187,699.6717,148.2734,247.4590,       24,9999269999,289999);//Case 6
    
AddPlayerClass(154,        2230.8042,-2460.3716,61.6104,279.1390,       24,9999269999,289999);//Case 7
    
AddPlayerClass(195,        1472.3932,-2286.8137,42.0187,90.4601,        24,9999269999,289999);//Case 8
    
AddPlayerClass(85 ,        1822.1333,-1682.5481,13.3828,88.4118,         24,9999269999,289999);//Case 9
    
return 1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
switch(
classid) {
        case 
0:
            
SetPlayerPos(playerid,1628.6528,-2290.0068,94.1270,215.9542);
            
SetPlayerCameraPos(playerid1628.6528,-2290.0068,94.1270,215.9542);
            
SetPlayerCameraLookAt(playerid,1628.6528,-2290.0068,94.1270,215.9542);
        case 
1:
            
SetPlayerPos(playerid,1210.7349,-2036.7631,69.0078,270.1496);
            
SetPlayerCameraPos(playerid1210.7349,-2036.7631,69.0078,270.1496);
            
SetPlayerCameraLookAt(playerid,1210.7349,-2036.7631,69.0078,270.1496);
        case 
2
            
SetPlayerPos(playerid,2111.3210,1258.4351,10.8203,107.3569);
            
SetPlayerCameraPos(playerid,2111.3210,1258.4351,10.8203,107.3569);
            
SetPlayerCameraLookAt(playerid,2111.3210,1258.4351,10.8203,107.3569);
        case 
3:
            
SetPlayerPos(playerid,2112.4336,1152.0609,13.5166,61.5863);
            
SetPlayerCameraPos(playerid,2112.4336,1152.0609,13.5166,61.5863);
            
SetPlayerCameraLookAt(playerid,2112.4336,1152.0609,13.5166,61.5863);
        case 
4:
            
SetPlayerPos(playerid,-1383.6305,680.5055,84.0078,188.0059 );
            
SetPlayerCameraPos(playerid, -1383.6305,680.5055,84.0078,188.0059);
            
SetPlayerCameraLookAt(playerid,-1383.6305,680.5055,84.0078,188.0059 );
        case 
5:
            
SetPlayerPos(playerid,-1544.6187,699.6717,148.2734,247.4590 );
            
SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734,247.4590 );
            
SetPlayerCameraLookAt(playerid,-1544.6187,699.6717,148.2734,247.4590 );
        case 
6:
            
SetPlayerPos(playerid,-1544.6187,699.6717,148.2734,247.4590 );
            
SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734,247.4590 );
            
SetPlayerCameraLookAt(playerid, -1544.6187,699.6717,148.2734,247.4590);
        case 
7:
            
SetPlayerPos(playerid,2230.8042,-2460.3716,61.6104,279.1390 );
            
SetPlayerCameraPos(playerid,2230.8042,-2460.3716,61.6104,279.1390 );
            
SetPlayerCameraLookAt(playerid2230.8042,-2460.3716,61.6104,279.1390);
        case 
8:
            
SetPlayerPos(playerid,1472.3932,-2286.8137,42.0187,90.4601 );
            
SetPlayerCameraPos(playerid,1472.3932,-2286.8137,42.0187,90.4601 );
            
SetPlayerCameraLookAt(playerid1472.3932,-2286.8137,42.0187,90.4601);
        case 
9:
            
SetPlayerPos(playerid,1822.1333,-1682.5481,13.3828,88.4118 );
            
SetPlayerCameraPos(playerid,1822.1333,-1682.5481,13.3828,88.4118 );
            
SetPlayerCameraLookAt(playerid1822.1333,-1682.5481,13.3828,88.4118);
    }

errors:
PHP код:
E:\GTA\gamemodes\mg.pwn(68) : warning 202number of arguments does not match definition
E
:\GTA\gamemodes\mg.pwn(69) : error 002only a single statement (or expressioncan follow each "case"
E:\GTA\gamemodes\mg.pwn(69) : warning 215expression has no effect
E
:\GTA\gamemodes\mg.pwn(70) : warning 213tag mismatch
E
:\GTA\gamemodes\mg.pwn(71) : warning 217loose indentation
E
:\GTA\gamemodes\mg.pwn(71) : error 014invalid statementnot in switch
E:\GTA\gamemodes\mg.pwn(71) : warning 215expression has no effect
E
:\GTA\gamemodes\mg.pwn(71) : error 001expected token";"but found ":"
E:\GTA\gamemodes\mg.pwn(71) : error 029invalid expressionassumed zero
E
:\GTA\gamemodes\mg.pwn(71) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
5 Errors

I think my Pawn bugged or something... why the errors only at case 0 and case 1??
Reply
#4

Код:
public OnPlayerRequestClass(playerid, classid)
{
switch(classid) {
        case 0: {
            SetPlayerPos(playerid,1628.6528,-2290.0068,94.1270,215.9542);
            SetPlayerCameraPos(playerid, 1628.6528,-2290.0068,94.1270,215.9542);
            SetPlayerCameraLookAt(playerid,1628.6528,-2290.0068,94.1270,215.9542);
		}
        case 1: {
            SetPlayerPos(playerid,1210.7349,-2036.7631,69.0078,270.1496);
            SetPlayerCameraPos(playerid, 1210.7349,-2036.7631,69.0078,270.1496);
            SetPlayerCameraLookAt(playerid,1210.7349,-2036.7631,69.0078,270.1496);
        }
		case 2: {
            SetPlayerPos(playerid,2111.3210,1258.4351,10.8203,107.3569);
            SetPlayerCameraPos(playerid,2111.3210,1258.4351,10.8203,107.3569);
            SetPlayerCameraLookAt(playerid,2111.3210,1258.4351,10.8203,107.3569);
		}
		case 3: {
        	SetPlayerPos(playerid,2112.4336,1152.0609,13.5166,61.5863);
            SetPlayerCameraPos(playerid,2112.4336,1152.0609,13.5166,61.5863);
            SetPlayerCameraLookAt(playerid,2112.4336,1152.0609,13.5166,61.5863);
        }
 	    case 4: {
            SetPlayerPos(playerid,-1383.6305,680.5055,84.0078,188.0059 );
            SetPlayerCameraPos(playerid, -1383.6305,680.5055,84.0078,188.0059);
            SetPlayerCameraLookAt(playerid,-1383.6305,680.5055,84.0078,188.0059 );
        }
		case 5: {
            SetPlayerPos(playerid,-1544.6187,699.6717,148.2734,247.4590 );
            SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734,247.4590 );
            SetPlayerCameraLookAt(playerid,-1544.6187,699.6717,148.2734,247.4590 );
        }
		case 6: {
            SetPlayerPos(playerid,-1544.6187,699.6717,148.2734,247.4590 );
            SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734,247.4590 );
            SetPlayerCameraLookAt(playerid, -1544.6187,699.6717,148.2734,247.4590);
        }
		case 7: {
            SetPlayerPos(playerid,2230.8042,-2460.3716,61.6104,279.1390 );
            SetPlayerCameraPos(playerid,2230.8042,-2460.3716,61.6104,279.1390 );
            SetPlayerCameraLookAt(playerid, 2230.8042,-2460.3716,61.6104,279.1390);
        }
		case 8: {
            SetPlayerPos(playerid,1472.3932,-2286.8137,42.0187,90.4601 );
            SetPlayerCameraPos(playerid,1472.3932,-2286.8137,42.0187,90.4601 );
            SetPlayerCameraLookAt(playerid, 1472.3932,-2286.8137,42.0187,90.4601);
        }
		case 9: {
            SetPlayerPos(playerid,1822.1333,-1682.5481,13.3828,88.4118 );
            SetPlayerCameraPos(playerid,1822.1333,-1682.5481,13.3828,88.4118 );
            SetPlayerCameraLookAt(playerid, 1822.1333,-1682.5481,13.3828,88.4118);
		}
    }
}
Your functions are wrong. Read this:
SetPlayerPos
SetPlayerCameraPos
SetPlayerCameraLookAt
Reply
#5

If u can please tell me what to do.
I mean tell me the Right Code and i will replace it.
And why Only case 0 and case 1 have errors??
Reply
#6

Quote:
Originally Posted by oktokt1
Посмотреть сообщение
If u can please tell me what to do.
I mean tell me the Right Code and i will replace it.
And why Only case 0 and case 1 have errors??
The case can have error because you not used brackets. { }
The warnings are because you added more paramenters...
Look this example:

Код:
Function     param1    param2   param3  param4
SetPlayerPos(playerid, Float:x, Float:y, Float:z)
You added more of the 4 params, this result in warnings.
Reply
#7

Now?? :
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
switch(
classid) {
        case 
0:
            
SetPlayerPos(playerid,1628.6528,-2290.0068,94.1270);
            
SetPlayerCameraPos(playerid1628.6528,-2290.0068,94.1270);
            
SetPlayerCameraLookAt(playerid,1628.6528,-2290.0068,94.1270);
        case 
1:
            
SetPlayerPos(playerid,1210.7349,-2036.7631,69.0078);
            
SetPlayerCameraPos(playerid1210.7349,-2036.7631,69.0078);
            
SetPlayerCameraLookAt(playerid,1210.7349,-2036.7631,69.0078);
        case 
2:
            
SetPlayerPos(playerid,2111.3210,1258.4351,10.8203);
            
SetPlayerCameraPos(playerid,2111.3210,1258.4351,10.8203);
            
SetPlayerCameraLookAt(playerid,2111.3210,1258.4351,10.8203);
        case 
3:
            
SetPlayerPos(playerid,2112.4336,1152.0609,13.5166);
            
SetPlayerCameraPos(playerid,2112.4336,1152.0609,13.5166);
            
SetPlayerCameraLookAt(playerid,2112.4336,1152.0609,13.5166);
        case 
4:
            
SetPlayerPos(playerid,-1383.6305,680.5055,84.0078 );
            
SetPlayerCameraPos(playerid, -1383.6305,680.5055,84.0078);
            
SetPlayerCameraLookAt(playerid,-1383.6305,680.5055,84.0078);
        case 
5:
            
SetPlayerPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraLookAt(playerid,-1544.6187,699.6717,148.2734);
        case 
6:
            
SetPlayerPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraLookAt(playerid, -1544.6187,699.6717,148.2734);
        case 
7:
            
SetPlayerPos(playerid,2230.8042,-2460.3716,61.6104);
            
SetPlayerCameraPos(playerid,2230.8042,-2460.3716,61.6104);
            
SetPlayerCameraLookAt(playerid2230.8042,-2460.3716,61.6104);
        case 
8:
            
SetPlayerPos(playerid,1472.3932,-2286.8137,42.0187);
            
SetPlayerCameraPos(playerid,1472.3932,-2286.8137,42.0187);
            
SetPlayerCameraLookAt(playerid1472.3932,-2286.8137,42.0187);
        case 
9:
            
SetPlayerPos(playerid,1822.1333,-1682.5481,13.3828);
            
SetPlayerCameraPos(playerid,1822.1333,-1682.5481,13.3828);
            
SetPlayerCameraLookAt(playerid1822.1333,-1682.5481,13.3828);
    }

errors:
PHP код:
E:\GTA\gamemodes\mg.pwn(69) : error 002only a single statement (or expressioncan follow each "case"
E:\GTA\gamemodes\mg.pwn(69) : warning 215expression has no effect
E
:\GTA\gamemodes\mg.pwn(71) : warning 217loose indentation
E
:\GTA\gamemodes\mg.pwn(71) : error 014invalid statementnot in switch
E:\GTA\gamemodes\mg.pwn(71) : warning 215expression has no effect
E
:\GTA\gamemodes\mg.pwn(71) : error 001expected token";"but found ":"
E:\GTA\gamemodes\mg.pwn(71) : error 029invalid expressionassumed zero
E
:\GTA\gamemodes\mg.pwn(71) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


5 Errors

Reply
#8

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    switch(
classid) {
        case 
0:
        {
            
SetPlayerPos(playerid,1628.6528,-2290.0068,94.1270);
            
SetPlayerCameraPos(playerid1628.6528,-2290.0068,94.1270);
            
SetPlayerCameraLookAt(playerid,1628.6528,-2290.0068,94.1270);
        }
        case 
1:
        {
            
SetPlayerPos(playerid,1210.7349,-2036.7631,69.0078);
            
SetPlayerCameraPos(playerid1210.7349,-2036.7631,69.0078);
            
SetPlayerCameraLookAt(playerid,1210.7349,-2036.7631,69.0078);
        }
        case 
2:
        {
            
SetPlayerPos(playerid,2111.3210,1258.4351,10.8203);
            
SetPlayerCameraPos(playerid,2111.3210,1258.4351,10.8203);
            
SetPlayerCameraLookAt(playerid,2111.3210,1258.4351,10.8203);
        }
        case 
3:
        {
            
SetPlayerPos(playerid,2112.4336,1152.0609,13.5166);
            
SetPlayerCameraPos(playerid,2112.4336,1152.0609,13.5166);
            
SetPlayerCameraLookAt(playerid,2112.4336,1152.0609,13.5166);
        }
        case 
4:
        {
            
SetPlayerPos(playerid,-1383.6305,680.5055,84.0078 );
            
SetPlayerCameraPos(playerid, -1383.6305,680.5055,84.0078);
            
SetPlayerCameraLookAt(playerid,-1383.6305,680.5055,84.0078);
        }
        case 
5:
        {
            
SetPlayerPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraLookAt(playerid,-1544.6187,699.6717,148.2734);
        }
        case 
6:
        {
            
SetPlayerPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraLookAt(playerid, -1544.6187,699.6717,148.2734);
        }
        case 
7:
        {
            
SetPlayerPos(playerid,2230.8042,-2460.3716,61.6104);
            
SetPlayerCameraPos(playerid,2230.8042,-2460.3716,61.6104);
            
SetPlayerCameraLookAt(playerid2230.8042,-2460.3716,61.6104);
        }
        case 
8:
        {
            
SetPlayerPos(playerid,1472.3932,-2286.8137,42.0187);
            
SetPlayerCameraPos(playerid,1472.3932,-2286.8137,42.0187);
            
SetPlayerCameraLookAt(playerid1472.3932,-2286.8137,42.0187);
        }
        case 
9:
        {
            
SetPlayerPos(playerid,1822.1333,-1682.5481,13.3828);
            
SetPlayerCameraPos(playerid,1822.1333,-1682.5481,13.3828);
            
SetPlayerCameraLookAt(playerid1822.1333,-1682.5481,13.3828);
        }
    }
    return 
true;

Reply
#9

Quote:
Originally Posted by oktokt1
Посмотреть сообщение
Now?? :
PHP код:
public OnPlayerRequestClass(playeridclassid)
{
switch(
classid) {
        case 
0:
            
SetPlayerPos(playerid,1628.6528,-2290.0068,94.1270);
            
SetPlayerCameraPos(playerid1628.6528,-2290.0068,94.1270);
            
SetPlayerCameraLookAt(playerid,1628.6528,-2290.0068,94.1270);
        case 
1:
            
SetPlayerPos(playerid,1210.7349,-2036.7631,69.0078);
            
SetPlayerCameraPos(playerid1210.7349,-2036.7631,69.0078);
            
SetPlayerCameraLookAt(playerid,1210.7349,-2036.7631,69.0078);
        case 
2:
            
SetPlayerPos(playerid,2111.3210,1258.4351,10.8203);
            
SetPlayerCameraPos(playerid,2111.3210,1258.4351,10.8203);
            
SetPlayerCameraLookAt(playerid,2111.3210,1258.4351,10.8203);
        case 
3:
            
SetPlayerPos(playerid,2112.4336,1152.0609,13.5166);
            
SetPlayerCameraPos(playerid,2112.4336,1152.0609,13.5166);
            
SetPlayerCameraLookAt(playerid,2112.4336,1152.0609,13.5166);
        case 
4:
            
SetPlayerPos(playerid,-1383.6305,680.5055,84.0078 );
            
SetPlayerCameraPos(playerid, -1383.6305,680.5055,84.0078);
            
SetPlayerCameraLookAt(playerid,-1383.6305,680.5055,84.0078);
        case 
5:
            
SetPlayerPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraLookAt(playerid,-1544.6187,699.6717,148.2734);
        case 
6:
            
SetPlayerPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraPos(playerid,-1544.6187,699.6717,148.2734);
            
SetPlayerCameraLookAt(playerid, -1544.6187,699.6717,148.2734);
        case 
7:
            
SetPlayerPos(playerid,2230.8042,-2460.3716,61.6104);
            
SetPlayerCameraPos(playerid,2230.8042,-2460.3716,61.6104);
            
SetPlayerCameraLookAt(playerid2230.8042,-2460.3716,61.6104);
        case 
8:
            
SetPlayerPos(playerid,1472.3932,-2286.8137,42.0187);
            
SetPlayerCameraPos(playerid,1472.3932,-2286.8137,42.0187);
            
SetPlayerCameraLookAt(playerid1472.3932,-2286.8137,42.0187);
        case 
9:
            
SetPlayerPos(playerid,1822.1333,-1682.5481,13.3828);
            
SetPlayerCameraPos(playerid,1822.1333,-1682.5481,13.3828);
            
SetPlayerCameraLookAt(playerid1822.1333,-1682.5481,13.3828);
    }

errors:
PHP код:
E:\GTA\gamemodes\mg.pwn(69) : error 002only a single statement (or expressioncan follow each "case"
E:\GTA\gamemodes\mg.pwn(69) : warning 215expression has no effect
E
:\GTA\gamemodes\mg.pwn(71) : warning 217loose indentation
E
:\GTA\gamemodes\mg.pwn(71) : error 014invalid statementnot in switch
E:\GTA\gamemodes\mg.pwn(71) : warning 215expression has no effect
E
:\GTA\gamemodes\mg.pwn(71) : error 001expected token";"but found ":"
E:\GTA\gamemodes\mg.pwn(71) : error 029invalid expressionassumed zero
E
:\GTA\gamemodes\mg.pwn(71) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
5 Errors

Now the parameters are correct, but did not add the brackets.
Look other example:

Код:
//CORRECT FORM 1
//Only one function in this case.
case 0: SetPlayerPos(playerid,1628.6528,-2290.0068,94.1270);
Код:
//CORRECT FORM 1
//More than one function
case 0: {
SetPlayerPos(playerid,1628.6528,-2290.0068,94.1270);
SetPlayerCameraPos(playerid, 1628.6528,-2290.0068,94.1270);
SetPlayerCameraLookAt(playerid,1628.6528,-2290.0068,94.1270);
}
Reply
#10

Ok Thnx Alot +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)