I need some help with this.
#1

Im trying to put this in my LuxAdmin.pwn...But having a hard time putting it in the right place. Can anyone help me on this?

pawn Код:
Float:GetXYInFrontOfPlayer(playerid, &Float:q, &Float:w, Float:distance)
        {
        new Float:a;
        GetPlayerPos(playerid, q, w, a);
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
        else GetPlayerFacingAngle(playerid, a);
        q += (distance * floatsin(-a, degrees));
        w += (distance * floatcos(-a, degrees));
        return a;
        }

        Float:GetXYBehindPlayer(playerid, &Float:q, &Float:w, Float:distance)
        {
        new Float:a;
        GetPlayerPos(playerid, q, w, a);
        if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
        else GetPlayerFacingAngle(playerid, a);
        q += (distance * -floatsin(-a, degrees));
        w += (distance * -floatcos(-a, degrees));
        return a;
    }

strtok(const string[], &index)

new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

public FlyTimer()
{
    new keys, updown, leftright;
    for(new playerid=0;playerid<MAX_PLAYERS;playerid++) {
    if(IsPlayerConnected(playerid)) {
        if(fly[playerid] == 1) {
        GetPlayerKeys(playerid,keys,updown,leftright);
        if(updown == KEY_UP) {
                if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
GetPlayerPos(playerid, x, y, z);
GetXYInFrontOfPlayer(playerid, x, y, 5.0);
SetPlayerPos(playerid, x, y, z);
SetCameraBehindPlayer(playerid);
}
                else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
new playercar = GetPlayerVehicleID(playerid);
GetVehiclePos(playercar, x, y, z);
GetXYInFrontOfPlayer(playerid, x, y, 5.0);
SetVehiclePos(playercar, x, y, z);
}
}
        else if(updown == KEY_DOWN) {
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
GetPlayerPos(playerid, x, y, z);
GetXYBehindPlayer(playerid, x, y, 5.0);
SetPlayerPos(playerid, x, y, z);
SetCameraBehindPlayer(playerid);
}
        else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
    new playercar = GetPlayerVehicleID(playerid);
    GetVehiclePos(playercar, x, y, z);
    GetXYBehindPlayer(playerid, x, y, 5.0);
    SetVehiclePos(playercar, x, y, z);
}
}
        if(leftright == KEY_LEFT) {
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
GetPlayerFacingAngle(playerid, angle);
SetPlayerFacingAngle(playerid, angle+10);
SetCameraBehindPlayer(playerid);
}
else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
    new playercar = GetPlayerVehicleID(playerid);
    GetVehicleZAngle(playercar, angle);
    SetVehicleZAngle(playercar, angle+10);
}
}
        else if(leftright == KEY_RIGHT) {
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
GetPlayerFacingAngle(playerid, angle);
SetPlayerFacingAngle(playerid, angle-10);
SetCameraBehindPlayer(playerid);
}
else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
    new playercar = GetPlayerVehicleID(playerid);
    GetVehicleZAngle(playercar, angle);
    SetVehicleZAngle(playercar, angle-10);
}
}
        if(keys == KEY_JUMP) {
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+5);
SetCameraBehindPlayer(playerid);
}
        else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
new playercar = GetPlayerVehicleID(playerid);
GetVehiclePos(playercar, x, y, z);
SetVehiclePos(playercar, x, y, z+5);
}
}
        else if(keys == KEY_SPRINT) {
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z-5);
SetCameraBehindPlayer(playerid);
}
        else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
new playercar = GetPlayerVehicleID(playerid);
GetVehiclePos(playercar, x, y, z);
SetVehiclePos(playercar, x, y, z-5);
}
}
}
}
}
}
Reply
#2

Post your errors and the lines of the errors.
Reply
#3

dont have errors really... just need help on where it goes like is there a float section, and where would strtok go...im new to scripting just thought i'd see if anyone had pointers or w/e.
Reply
#4

If you wan't be disorganized just paste those codes into the script. I don't know how LuXAdmin organizes itself, if you don't know where to paste something, just paste it at the bottom of your script.
Reply
#5

Iight i did that this is what i got.

pawn Код:
warning 219: local variable "offset" shadows a variable at a preceding level
219: local variable "result" shadows a variable at a preceding level
warning 219: local variable "offset" shadows a variable at a preceding level
warning 219: local variable "result" shadows a variable at a preceding level
warning 219: local variable "offset" shadows a variable at a preceding level
warning 219: local variable "result" shadows a variable at a preceding level
error 021: symbol already defined: "strtok"
error 003: declaration of a local variable must appear in a compound block
error 010: invalid function or declaration
fatal error 107: too many error messages on one line
Reply
#6

Quote:

warning 219: local variable "offset" shadows a variable at a preceding level
219: local variable "result" shadows a variable at a preceding level
warning 219: local variable "offset" shadows a variable at a preceding level
warning 219: local variable "result" shadows a variable at a preceding level
warning 219: local variable "offset" shadows a variable at a preceding level
warning 219: local variable "result" shadows a variable at a preceding level

Rename the variables in the functions.

Quote:

error 021: symbol already defined: "strtok"

Delete strtok.

Quote:

error 003: declaration of a local variable must appear in a compound block
error 010: invalid function or declaration
fatal error 107: too many error messages on one line

Show the lines.
Reply
#7

12541 - new length = strlen(string);
12539 - strtok(const string[], &index)
12539-12542 - strtok(const string[], &index)
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))


When i delete strtok it stops repsonding.
Reply
#8

Well I can't really help you BUT.
I have a tip for you.
Try to write everything yourself in one gamemode.
This will be better. I do it that way too.
Reply
#9

You're only supposed to delete the one you pasted, or did you already do that?
Reply
#10

i did that then it would stop responding.

and the changing variables thing...here is what is on each line

line 377 - {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob "},{"Tampa"},{"Sunrise"},{"Merit"},
line 378 - {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{" Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
line 633 - if(ServerInfo[NameKick] == 1)
line 634 - {
line 813 - SuperPunch[playerid] = 0;
line 814 - if(AccInfo[playerid][Jailed] == 1)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)