Sendername Eror Pomoc

Započeo BornToLearn, Avgust 15, 2009, 17:01:58 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Radim komandu /oprema s menuom ... svrha komande je da igrac uzme jedan od vise ponudenih paketa oruzija...
Za pocetak vam evo svi dijelovi skripte:


new:
//Menus
new Menu:oprema;


Komanda:
if(!strcmp(cmd, "/oprema", true))
{
{
  if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
    {
    if(!PlayerToPoint(2.0, playerid, 240.7681,112.8425,1003.2188)) return SendClientMessage(playerid, COLOR_YELLOW, "Niste u Police Armory-u");
        ShowMenuForPlayer(legaljobmenu, playerid);
        TogglePlayerControllable(playerid, 0);
    return 1;
    }
}


OnGameModeinit:
oprema = CreateMenu("Oprema", 1, 410.0,110.0, 150.0,150.0);
AddMenuItem(oprema, 0, "Health");
AddMenuItem(oprema, 0, "Desert eagle + Suzavac");
AddMenuItem(oprema, 0, "Desert eagle + Mp5");
AddMenuItem(oprema, 0, "Desert eagle + M4");
AddMenuItem(oprema, 0, "Desert eagle + Shotgun");


public OnPlayerSelectedMenuRow(playerid, row):
public OnPlayerSelectedMenuRow(playerid, row)
{
    new Menu:CurrentMenu = GetPlayerMenu(playerid);
    if(CurrentMenu == oprema)
{
        switch(row)
    {
      case 0: // Health
        {
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
                GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s se najeo i stavio pancirku na sebe.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    TogglePlayerControllable(playerid, 1);
        }
          case 1: // Desert eagle + Suzavac
            {
GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 365, 600);
                GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i suzavac.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    TogglePlayerControllable(playerid, 1);
        }
        case 2: // Desert eagle + Mp5
            {
          GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 353, 600);
                GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i Mp5.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    TogglePlayerControllable(playerid, 1);
        }
        case 3: // Desert eagle + M4
        {
        GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 356, 600);
                GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i M4.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    TogglePlayerControllable(playerid, 1);
        }
        case 4: // Desert eagle + Shotgun
        {
          GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 349, 600);
                GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i M4.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    TogglePlayerControllable(playerid, 1);
        }
}
}
return 1;
}


public OnPlayerExitedMenu(playerid):
public OnPlayerExitedMenu(playerid)
{
    new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == oprema)
{
    TogglePlayerControllable(playerid, 1);
}
return 1;
}


I kolko ja vidim nigdje nema greske a uvijek dobijam erore:
D:\PROGRA~1\NEWYOR~1\NYCRP.pwn(3466) : error 017: undefined symbol "sendername"
D:\PROGRA~1\NEWYOR~1\NYCRP.pwn(3466) : error 017: undefined symbol "sendername"
D:\PROGRA~1\NEWYOR~1\NYCRP.pwn(3466) : error 029: invalid expression, assumed zero
D:\PROGRA~1\NEWYOR~1\NYCRP.pwn(3466) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


Probavo sam na svakakve nacine definirat sendername ali neide...
Molim pomoc hitno ;)
Unaprijed hvala

Uz malo dobre volje i malo necije pomoci sve se moze naucit ;)...pa tako ima nade da i ja postanem jedan od boljih skriptera ;)

Correlli

Jednostavno:
new sendername[MAX_PLAYER_NAME];

Puno ti hvala,malo sam glup ispo s tako prelaganim "problemom" za rijesit ali nadam se da razumijete tek se ucim ;)...sada znam za ubuduce...
Odma kada sam to dodao i compilao dobio sam eror za string i vec sam po prijemjeru erora prije sam znao sta trebam
new string[256]; i tako sam ga rijesio... :)
Jos jednom hvala...
Na kraju ovako sam sve rijesio:


public OnPlayerSelectedMenuRow(playerid, row):
public OnPlayerSelectedMenuRow(playerid, row)
{
   new string[256];
new sendername[MAX_PLAYER_NAME];
   new Menu:CurrentMenu = GetPlayerMenu(playerid);
   if(CurrentMenu == oprema)
{
       switch(row)
    {
    case 0: // Health
       {
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s se najeo i stavio pancirku na sebe.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   TogglePlayerControllable(playerid, 1);
       }
         case 1: // Desert eagle + Suzavac
         {
GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 365, 600);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i suzavac.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   TogglePlayerControllable(playerid, 1);
       }
       case 2: // Desert eagle + Mp5
         {
          GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 353, 600);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i Mp5.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   TogglePlayerControllable(playerid, 1);
        }
        case 3: // Desert eagle + M4
        {
      GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 356, 600);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i M4.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   TogglePlayerControllable(playerid, 1);
        }
        case 4: // Desert eagle + Shotgun
      {
        GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 349, 600);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i M4.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   TogglePlayerControllable(playerid, 1);
        }
}
}
return 1;
}
Poslednja Izmena: Avgust 15, 2009, 17:21:30 POSLE PODNE od BornToLearn
Uz malo dobre volje i malo necije pomoci sve se moze naucit ;)...pa tako ima nade da i ja postanem jedan od boljih skriptera ;)

Correlli

new string[256];
Ne treba ti 256, to ti je previše za game-text, bolje je da koristiš 128.

Citat: Don Correlli poslato Avgust 15, 2009, 17:23:57 POSLE PODNE
new string[256];
Ne treba ti 256, to ti je previše za game-text, bolje je da koristiš 128.

Stavio sam tako(sad kad si mi reko)...
...nebi te htio previse smarat ali ako je jednostavno bili mi mogao ukratko rec koja je razlika i kada se koji koristi jer kad vec ucim da naucim kako treba ;)...
...ako je tesko za objasnit onda nemoj...;)
Poslednja Izmena: Avgust 15, 2009, 17:26:31 POSLE PODNE od BornToLearn
Uz malo dobre volje i malo necije pomoci sve se moze naucit ;)...pa tako ima nade da i ja postanem jedan od boljih skriptera ;)


Hvala ti procito sam sad mi ja malo jasnije...
Ali imam jedan drugi problem...skripta mi ne izvrsava svoju funkciju davanja oruzija igracu.Pod opciju 1 naveden je Health(100HP i Armor) i rade uredu,a pod ostale 3 opcije sam stavio da igracu daje oruzije ali tu nastaje problem ne radi kako treba uopce ne daje oruzije igracu.Znaci sve je sredeno i sve sam pregledao par puta i stvarno nevidim problem,compilam ga bez problema (bez erora i warninga)...Ja cu ovdje stavit dio skripte pa onaj tko vidit problem neka mi kaze da to sto prije rijesim da idem dalje ;)...


Dio skripte:
public OnPlayerSelectedMenuRow(playerid, row)
{
   new string[128];
new sendername[MAX_PLAYER_NAME];
   new Menu:CurrentMenu = GetPlayerMenu(playerid);
   if(CurrentMenu == oprema)
{
       switch(row)
    {
    case 0: // Health
       {
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s se najeo i stavio pancirku na sebe.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               TogglePlayerControllable(playerid, 1);
   }
         case 1: // Desert eagle + Suzavac
         {
GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 365, 600);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i Suzavac.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               TogglePlayerControllable(playerid, 1);
}
       case 2: // Desert eagle + Mp5
         {
          GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 353, 600);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i Mp5.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               TogglePlayerControllable(playerid, 1);
}
        case 3: // Desert eagle + M4
        {
      GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 356, 600);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i M4.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
               TogglePlayerControllable(playerid, 1);
}
        case 4: // Desert eagle + Shotgun
      {
        GivePlayerWeapon(playerid, 348, 200);
GivePlayerWeapon(playerid, 349, 600);
               GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s je uzeo Desert eagle i M4.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
   TogglePlayerControllable(playerid, 1);
        }
}
}
return 1;
}


Unaprijed hvala
Poslednja Izmena: Avgust 15, 2009, 19:47:37 POSLE PODNE od BornToLearn
Uz malo dobre volje i malo necije pomoci sve se moze naucit ;)...pa tako ima nade da i ja postanem jedan od boljih skriptera ;)

turker_kc

Krivi IDevi ??

Stavio si pod  case 1: // Desert eagle + Suzavac
              {
             GivePlayerWeapon(playerid, 348, 200);
            GivePlayerWeapon(playerid, 365, 600);

Desert Eagle ti je 24
a suzavac ti je 17
shotgun ti je ID 25
MP5 29
M4 31


OMG ja ocito nevidim dobro,gledao sam OVDJE ID-eve,ali mi je oko cini se pobjeglo na "Model ID"(Stupac pored ID)...
Hvala ti puno to mi nikad nebi palo na pamet jer nisam niti pomislio da sam fulo ID,sada radi perfektno ;)

Evo vam i jedna slika ;)

KLIKNI DA VIDIS SLIKU

Uz malo dobre volje i malo necije pomoci sve se moze naucit ;)...pa tako ima nade da i ja postanem jedan od boljih skriptera ;)

turker_kc

Dinkec to si ti ;D drago mi je da sam pomogao :D :D

i da BTW ako ce ti trebat :D

Oruzja - http://wiki.sa-mp.com/wiki/Weapons
Vozila - http://wiki.sa-mp.com/wiki/Vehicle_Model_ID_List
Skinovi - http://wiki.sa-mp.com/wiki/Category:Skins
Intovi - http://weedarr.wikidot.com/interior
Poslednja Izmena: Avgust 15, 2009, 21:12:36 POSLE PODNE od turker_kc

Znam di mogu nac ID-eve ;)...

btw. ko ce bit :) podvalila mi keylogger djubrad -_- (izbriso antivirus jer mi neda pola programa koristit)
Poslednja Izmena: Avgust 20, 2009, 16:28:41 POSLE PODNE od zerocoolos
Uz malo dobre volje i malo necije pomoci sve se moze naucit ;)...pa tako ima nade da i ja postanem jedan od boljih skriptera ;)