Scripting Help [TEAMS/GANGS]
#1

i need help i want to create gangs with pawno



On Top of Script:


new gTeam[MAX_PLAYERS];
#define TEAM_WORKERS 1
#define TEAM_AGENTS 2
#define SetPlayerTeamFromClass


public OnPlayerRequestClass(playerid, classid)


SetPlayerTeamFromClass(playerid, classid);//Add this line to the end!
{
if(classid == 0)
{
gTeam[playerid] = TEAM_WORKERS;
SetPlayerTeam(playerid,TEAM_WORKERS);//You can delete this line if you want to allow team killing...
GameTextForPlayer(playerid,"~g~Workers",10,0);
}
else if(classid == 1)
{
gTeam[playerid] = TEAM_AGENTS;
SetPlayerTeam(playerid,TEAM_AGENTS);//Same for this!
GameTextForPlayer(playerid,"~r~Agents",10,0);
}
}
return 1;
}



public OnPlayerSpawn(playerid)
{
if(GetPlayerTeam(playerid) == TEAM_AGENTS)
{
SetPlayerPos(playerid,-2136.3921,-124.4632,36.5191);//Chnage this to the spawnpoint of your Agents Team!
SetPlayerHealth(playerid,100);
}
else if(GetPlayerTeam(playerid) == TEAM_WORKERS)
{
SetPlayerHealth(playerid,100);
SetPlayerPos(playerid,-2016.3192,130.2446,27.6875);//Chnage this to the spawnpoint of your Workers Team!
}
}


return 1;
}


Now i become these 2 errors -.- : C:\Users\Josh\Desktop\gta server\gamemodes\RPG.pwn(84) : warning 215: expression has no effect
C:\Users\Josh\Desktop\gta server\gamemodes\RPG.pwn(127) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Can someone HELP me? please? i cant find my mistake -.- dont send me http://wiki.sa-mp.co...N_for_Begginers!


i know how to script but its hard for me to script a team so please help lol
Reply
#2

Remove the #define SetPlayerTeamFromClass.

Then put on top on OnPlayerRequestClass:

pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
      SetPlayerTeamFromClass(playerid, classid);
      // Your function
}
Then, put this OUTSIDE any public!

pawn Code:
SetPlayerTeamFromClass(playerid, classid)
{
     if(classid == 0)
     {
         // your code
     }
     // etcetera
}
Hope this helps
Reply
#3

EDIT: ^
Reply
#4

thanks i try it now
Reply
#5

Remove this
pawn Code:
#define SetPlayerTeamFromClass
Fixed
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
}

SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0) {
        gTeam[playerid] = TEAM_WORKERS;
        SetPlayerTeam(playerid,TEAM_WORKERS);//You can delete this line if you want to allow team killing...
        GameTextForPlayer(playerid,"~g~Workers",10,0);
    }
    else if(classid == 1) {
        gTeam[playerid] = TEAM_AGENTS;
        SetPlayerTeam(playerid,TEAM_AGENTS);//Same for this!
        GameTextForPlayer(playerid,"~r~Agents",10,0);
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(GetPlayerTeam(playerid) == TEAM_AGENTS) {
        SetPlayerPos(playerid,-2136.3921,-124.4632,36.5191);//Chnage this to the spawnpoint of your Agents Team!
        SetPlayerHealth(playerid,100);
    }
    else if(GetPlayerTeam(playerid) == TEAM_WORKERS) {
        SetPlayerHealth(playerid,100);
        SetPlayerPos(playerid,-2016.3192,130.2446,27.6875);//Chnage this to the spawnpoint of your Workers Team!
    }
}
Reply
#6

hmmm it wont work here the error line


C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(65) : error 004: function "SetPlayerTeamFromClass" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(9 : warning 217: loose indentation
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(207) : error 055: start of function body without function header
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(20 : error 010: invalid function or declaration
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(214) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(221) : error 010: invalid function or declaration
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(223) : warning 203: symbol is never used: "gTeam"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.


Hmm you got Teamveiwer maybe you can do that for me ?
Reply
#7

Make sure you don't put the SetPlayerTeamFromClass function inside any public.
Please post your script again, with what you got after my and Daniel's help.
Reply
#8

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
}

SetPlayerTeamFromClass(playerid, classid);//Add this line to the end!
{
if(classid == 0)
{
gTeam[playerid] = TEAM_WORKERS;
SetPlayerTeam(playerid,TEAM_WORKERS);//You can delete this line if you want to allow team killing...
GameTextForPlayer(playerid,"~g~Workers",10,0);
}
else if(classid == 1)
{
gTeam[playerid] = TEAM_AGENTS;
SetPlayerTeam(playerid,TEAM_AGENTS);//Same for this!
GameTextForPlayer(playerid,"~r~Agents",10,0);
}
}
Reply
#9

Remplaze your function for this
pawn Code:
SetPlayerTeamFromClass(playerid, classid)  //Add this line to the end!
{
    if(classid == 0)
    {
        gTeam[playerid] = TEAM_WORKERS;
        SetPlayerTeam(playerid,TEAM_WORKERS);//You can delete this line if you want to allow team killing...
        GameTextForPlayer(playerid,"~g~Workers",10,0);
    }
    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_AGENTS;
        SetPlayerTeam(playerid,TEAM_AGENTS);//Same for this!
        GameTextForPlayer(playerid,"~r~Agents",10,0);
    }
}
Reply
#10

okay i did this but i become errors-.-

PHP Code:
public OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerTeamFromClass(playeridclassid)  //Add this line to the end!
    
{
    if(
classid == 0)
    {
    
gTeam[playerid] = TEAM_WORKERS;
    
SetPlayerTeam(playerid,TEAM_WORKERS);//You can delete this line if you want to allow team killing...
    
GameTextForPlayer(playerid,"~g~Workers",10,0);
    }
    else if(
classid == 1)
    {
    
gTeam[playerid] = TEAM_AGENTS;
    
SetPlayerTeam(playerid,TEAM_AGENTS);//Same for this!
    
GameTextForPlayer(playerid,"~r~Agents",10,0);
    }
    }
    
    return 
1;

ERRORS: C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(61) : error 017: undefined symbol "SetPlayerTeamFromClass"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#11

pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
}

SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0) {
        gTeam[playerid] = TEAM_WORKERS;
        SetPlayerTeam(playerid,TEAM_WORKERS);//You can delete this line if you want to allow team killing...
        GameTextForPlayer(playerid,"~g~Workers",10,0);
    }
    else if(classid == 1) {
        gTeam[playerid] = TEAM_AGENTS;
        SetPlayerTeam(playerid,TEAM_AGENTS);//Same for this!
        GameTextForPlayer(playerid,"~r~Agents",10,0);
    }
    return 1;
}
Reply
#12

pawn Code:
forward SetPlayerTeamFromClass(playerid, classid);

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}

public SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = TEAM_WORKERS;
        GameTextForPlayer(playerid,"~g~Workers",10,0);
    }
    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_AGENTS;
        GameTextForPlayer(playerid,"~r~Agents",10,0);
    }
    return 1;
}
This works for me.
Reply
#13

Thanks it works but i cant spawn when i click on spawn lol i adde playerclasses but i cant , why?
Reply
#14

EDIT: Nothing
Reply
#15

Have you still got
pawn Code:
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
at OnPlayerRequestClass?
Reply
#16

no i dont LOL , but how can i make this like , i look for a team that i want to choose then i change the camerapos etc. for any faction like Idlewood Ballas = Crackden , Kilo Tray Ballas = Glenpark
Reply
#17

pawn Code:
public SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        gTeam[playerid] = TEAM_WORKERS;
        GameTextForPlayer(playerid,"~g~Workers",10,0);
        SetPlayerPos(playerid,xcoord,ycoord,zcoord);
        SetCameraPos(playerid,xcoord,ycoord,zcoord);
        SetCameraLookat(playerid,xcoord,ycoord,zcoord);
    }
    else if(classid == 1)
    {
        gTeam[playerid] = TEAM_AGENTS;
        GameTextForPlayer(playerid,"~r~Agents",10,0);
        SetPlayerPos(playerid,xcoord,ycoord,zcoord);
        SetCameraPos(playerid,xcoord,ycoord,zcoord);
        SetCameraLookat(playerid,xcoord,ycoord,zcoord);
    }
    return 1;
}
Try that
Reply
#18

and i got this error when i add

SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);

in OnPlayerRequest Class


public OnPlayerRequestClass(playerid, classid)


SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);


{
SetPlayerTeamFromClass(playerid, classid);
}

SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0) {
gTeam[playerid] = TEAM_WORKERS;
SetPlayerTeam(playerid,TEAM_WORKERS);//You can delete this line if you want to allow team killing...
GameTextForPlayer(playerid,"~g~Workers",3000,5);
}
else if(classid == 1) {
gTeam[playerid] = TEAM_AGENTS;
SetPlayerTeam(playerid,TEAM_AGENTS);//Same for this!
GameTextForPlayer(playerid,"~r~Agents",3000,5);
}


return 1;
}



ERROR:

C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(64) : error 021: symbol already defined: "SetPlayerCameraPos"
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(6 : error 055: start of function body without function header
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(70) : error 054: unmatched closing brace ("}")
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(229) : warning 203: symbol is never used: "SetPlayerTeamFromClass"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#19

pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}
Reply
#20

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
{
SetPlayerTeamFromClass(playerid, classid);
}

SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0) {
gTeam[playerid] = TEAM_WORKERS;
SetPlayerTeam(playerid,TEAM_WORKERS);//You can delete this line if you want to allow team killing...
GameTextForPlayer(playerid,"~g~Workers",10,0);
}
else if(classid == 1) {
gTeam[playerid] = TEAM_AGENTS;
SetPlayerTeam(playerid,TEAM_AGENTS);//Same for this!
GameTextForPlayer(playerid,"~r~Agents",10,0);
}


return 1;
}


Errors:

C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(66) : error 017: undefined symbol "SetPlayerTeamFromClass"
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(69) : error 017: undefined symbol "SetPlayerTeamFromClass"
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(70) : warning 217: loose indentation
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(86) : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(86) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(86) : error 004: function "OnPlayerRequestSpawn" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(91) : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(91) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(91) : error 004: function "OnPlayerConnect" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(96) : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(96) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(96) : error 004: function "OnPlayerDisconnect" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(101) : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(101) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(101) : error 004: function "OnPlayerSpawn" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(11 : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(11 : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(11 : error 004: function "OnPlayerDeath" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(123) : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(123) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(123) : error 004: function "OnVehicleSpawn" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(12 : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(12 : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(12 : error 004: function "OnVehicleDeath" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(133) : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(133) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(133) : error 004: function "OnPlayerText" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(13 : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(13 : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(13 : error 004: function "OnPlayerPrivmsg" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(143) : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(143) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(143) : error 004: function "OnPlayerCommandText" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(145) : error 017: undefined symbol "cmdtext"
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(153) : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(153) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(153) : error 004: function "OnPlayerInfoChange" is not implemented
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(15 : warning 225: unreachable code
C:\Users\Josh\Desktop\gta server\gamemodes\JoshRPG.pwn(15 : error 029: invalid expression, assumed zero

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


26 Errors.


man im to dumb for script loool
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)