SA-MP Forums Archive
Problem.. [=+rep] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem.. [=+rep] (/showthread.php?tid=499510)



Problem.. [=+rep] - vassilis - 08.03.2014

Long time to script so i try to remember a lot things so anyway here is my code... i cant remember whats wrong actually..

pawn Код:
new gCopPlayer[MAX_PLAYERS]; // is this the mistake???

OnGameModeinit callback
gCopPlayer[0] = AddPlayerClass(165, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[1] = AddPlayerClass(166, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[2] = AddPlayerClass(280, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[3] = AddPlayerClass(281, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[4] = AddPlayerClass(282, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[5] = AddPlayerClass(283, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[6] = AddPlayerClass(284, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[7] = AddPlayerClass(285, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[8] = AddPlayerClass(286, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[9] = AddPlayerClass(287, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[10] = AddPlayerClass(288, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[11] = AddPlayerClass(163, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[12] = AddPlayerClass(164, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);

public OnPlayerRequestClass(playerid, classid)
{

    if(classid == gCopPlayer[classid])
    {
    SetPlayerPos(playerid, 293.108734, 182.532150, 1007.171875);
    SetPlayerFacingAngle(playerid, 121.455261);
    SetPlayerCameraLookAt(playerid, 293.108734, 182.532150, 1007.171875);
    SetPlayerCameraPos(playerid, 293.108734 + (10 * floatsin(-121.455261, degrees)), 182.532150 + (10 * floatcos(-121.455261, degrees)), 1007.171875);
    }
    return 1;
}
errors :
pawn Код:
(340) : error 010: invalid function or declaration
(415) : error 025: function heading differs from prototype
(420) : error 025: function heading differs from prototype
The lines that claims there are errors..(there is no error actually here) :
pawn Код:
// line 340
public OnPlayerStateChange(playerid, state, oldstate)
{
    return 1;
}
//line 415,420

public OnPlayerInteriorChange(playerid, interiorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, keys, oldkeys)
{
    return 1;
}
So what am i actually doing wrong..


Re: Problem.. [=+rep] - RenovanZ - 08.03.2014

pawn Код:
// line 340
public OnPlayerStateChange(playerid, state, oldstate)
{
    return 1;
}
//line 415,420

public OnPlayerInteriorChange(playerid, interiorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, keys, oldkeys)
{
    return 1;
}
Should be

pawn Код:
// line 340
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}
//line 415,420

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}
Its because you have different parameters between your script and a_samp include.


Re: Problem.. [=+rep] - vassilis - 08.03.2014

oh ye thats the mistake indeed i had delete the "new" word by mistake using control + h to replace some functions thanks lad.. +rep for something a bit annoying lol


Re: Problem.. [=+rep] - XK - 08.03.2014

you forgot to add new


Re: Problem.. [=+rep] - vassilis - 08.03.2014

Ye he helped me but anyway when i go to other skin it doesnt change position of the area :/ is it wrong??
pawn Код:
if(classid == gCopPlayer[classid])
    {
    SetPlayerPos(playerid, 293.108734, 182.532150, 1007.171875);
    SetPlayerFacingAngle(playerid, 121.455261);
    SetPlayerCameraLookAt(playerid, 293.108734, 182.532150, 1007.171875);
    SetPlayerCameraPos(playerid, 293.108734 + (10 * floatsin(-121.455261, degrees)), 182.532150 + (10 * floatcos(-121.455261, degrees)), 1007.171875);
    }
    if(classid == gMedicPlayer[classid])
    {
    SetPlayerPos(playerid, 1681.180419, 2068.083740, 11.359375);
    SetPlayerFacingAngle(playerid, 185.129440);
    SetPlayerCameraLookAt(playerid, 1681.180419, 2068.083740, 11.359375);
    SetPlayerCameraPos(playerid, 1681.180419 + (10 * floatsin(-185.129440, degrees)), 2068.083740 + (10 * floatcos(-185.129440, degrees)), 11.359375);
    }
pawn Код:
//Medics
    gMedicPlayer[0] = AddPlayerClass(274, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gMedicPlayer[1] = AddPlayerClass(275, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gMedicPlayer[2] = AddPlayerClass(276, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    // Cops,Cia,Fbi
    gCopPlayer[0] = AddPlayerClass(165, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[1] = AddPlayerClass(166, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[2] = AddPlayerClass(280, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[3] = AddPlayerClass(281, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[4] = AddPlayerClass(282, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[5] = AddPlayerClass(283, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[6] = AddPlayerClass(284, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[7] = AddPlayerClass(285, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[8] = AddPlayerClass(286, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[9] = AddPlayerClass(287, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[10] = AddPlayerClass(288, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[11] = AddPlayerClass(163, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    gCopPlayer[12] = AddPlayerClass(164, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);



Re: Problem.. [=+rep] - XK - 08.03.2014

just delete gCopPlayer[numbers] all of them and lets say gcopplayer is the 4th skin ,then use:
pawn Код:
if(classid == 4 && classid == 5 && classid == 6 classid == 7 & classid == 8 && classid == 6) // and put the others..
{
    SetPlayerPos(playerid, 293.108734, 182.532150, 1007.171875);
    SetPlayerFacingAngle(playerid, 121.455261);
    SetPlayerCameraLookAt(playerid, 293.108734, 182.532150, 1007.171875);
    SetPlayerCameraPos(playerid, 293.108734 + (10 * floatsin(-121.455261, degrees)), 182.532150 + (10 * floatcos(-121.455261, degrees)), 1007.171875);
}
if(classid == 1 && classid == 2 && classid == 3) //same
{
    SetPlayerPos(playerid, 1681.180419, 2068.083740, 11.359375);
    SetPlayerFacingAngle(playerid, 185.129440);
    SetPlayerCameraLookAt(playerid, 1681.180419, 2068.083740, 11.359375);
    SetPlayerCameraPos(playerid, 1681.180419 + (10 * floatsin(-185.129440, degrees)), 2068.083740 + (10 * floatcos(-185.129440, degrees)), 11.359375);
}
tell me if it works,because you didnt define classid for the ids i think


Re: Problem.. [=+rep] - vassilis - 08.03.2014

no ... it compiles i deleted what you told me but it doesnt show me now even the skin selection just the sky of los santos like when connecting